ToWrdB: Send Objects to Word and Bookmark Them

View source: R/DescTools.r

ToWrdBR Documentation

Send Objects to Word and Bookmark Them

Description

Send objects like tables, ftables, lm tables, TOnes or just simple texts to a MS-Word document and place a bookmark on them. This has the advantage, that objects in a Word document can be updated later, provided the bookmark name has been stored.

Usage

ToWrdB(x, font = NULL, ..., wrd = DescToolsOptions("lastWord"), 
        bookmark = gettextf("bmt%s", round(runif(1, min = 0.1) * 1e+09)))

Arguments

x

the object to be transferred to Word.

font

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).

...

further arguments to be passed to or from methods.

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").

bookmark

the name of the bookmark.

Details

This function encapsulates ToWrd, by placing a bookmark over the complete inserted results. The given name can be questioned with bm$name().

Value

a handle to the set bookmark

Author(s)

Andri Signorell <andri@signorell.net>

See Also

ToWrd, WrdInsertBookmark

Examples

## Not run: 
# we can't get this through the CRAN test - run it with copy/paste to console

wrd <- GetNewWrd()
bm <- ToWrdB("This is text to be possibly replaced later.")

# get the automatically created name of the bookmark
bm$name()

WrdGoto(bm$name())
UpdateBookmark(...)

## End(Not run)

DescTools documentation built on Sept. 26, 2024, 1:07 a.m.