R: Insert Caption to Word

WrdCaption {DescTools} | R Documentation

## Insert Caption to Word

### Description

Insert a caption in a given level to a Word document. The caption is inserted at the current cursor position.

### Usage

    WrdCaption(x, index = 1, wrd = DescToolsOptions("lastWord"))

### Arguments

`x` | the text of the caption.
`index` | integer from 1 to 9, defining the number of the heading style.
`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")`.

### Author(s)

Andri Signorell <andri@signorell.net>

### See Also

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

### Examples

    ## Not run:  # Windows-specific example
    wrd <- GetNewWrd()

    # insert a title in level 1
    WrdCaption("My First Caption level 1", index=1, wrd=wrd)

    # works as well for several levels
    sapply(1:5, function(i)
      WrdCaption(gettextf("My First Caption level %s",i), index=i, wrd=wrd)
    )

    ## End(Not run)

[Package DescTools version 0.99.24 Index]