R: Get or Set the Font in Word

WrdFont {DescTools} | R Documentation

## Get or Set the Font in Word

### Description

`WrdFont` can be used to get and set the font in Word for the text to be inserted. `WrdFont` returns the font at the current cursor position.

### Usage

    WrdFont(wrd = DescToolsOptions("lastWord"))
    WrdFont(wrd) <- value

### Arguments

`value` | the font to be used to the output. This should be defined as a list containing fontname, fontsize, bold and italic flags: `list(name="Arial", size=10, bold=FALSE, italic=TRUE, color=wdConst$wdColorBlack)`.
`wrd` | the pointer to a word instance. Can be a new one, created by `GetNewWrd()` or an existing one, created by `GetCurrWrd()`. Default is the last created pointer stored in `DescToolsOptions("lastWord")`.

### Details

The font color can be defined by a Word constant beginning with `wdConst$wdColor`. The defined colors can be listed with `grep("wdColor", names(wdConst), val=TRUE)`.

### Value

a list of the attributes of the font in the current cursor position:

`name` | the fontname
`size` | the fontsize
`bold` | bold
`italic` | italic
`color` | the fontcolor

### Author(s)

Andri Signorell <andri@signorell.net>

### See Also

`ToWrd`, `WrdPlot`, `GetNewWrd`, `GetCurrWrd`

### Examples

    ## Not run:  # Windows-specific example

    wrd <- GetNewWrd()

    for(i in seq(10, 24, 2))
      ToWrd(gettextf("This is Arial size

    for(i in seq(10, 24, 2))
      ToWrd(gettextf("This is Times size

    ## End(Not run)

[Package DescTools version 0.99.24 Index]