DescTools (version 0.99.8.1)

WrdSetFont: Set the Font in Word

Description

WrdSetFont sets the font in Word for the text to be inserted. WrdGetFont returns the font at the current cursor position.

Usage

WrdSetFont(fontname = "Consolas", fontsize = 7, bold = FALSE, italic = FALSE, 
           wrd = getOption("lastWord"))
WrdGetFont(wrd = getOption("lastWord"))

Arguments

fontname
the name of the font as defined by Windows.
fontsize
the size of the font in points.
bold, italic
does the expected.
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 getOption("lastWord").

Value

  • a list of the attributes of the font in the current cursor position:
  • namethe fontname
  • sizethe fontsize
  • boldbold
  • italicitalic

See Also

WrdText, WrdPlot, GetNewWrd, GetCurrWrd

Examples

Run this code
# Windows-specific example
# start word
wrd <- GetNewWrd()

for( i in seq(10, 24, 2)) {
  WrdText(gettextf("This is Arial size %s \n", i), appendCR=FALSE, 
    fontname="Arial", fontsize=i)
}
for( i in seq(10, 24, 2)) {
  WrdText(gettextf("This is Times size %s \n", i), appendCR=FALSE, 
    fontname="Times", fontsize=i)
}

Run the code above in your browser using DataCamp Workspace