Some Functions to Handle MS-Word Bookmarks
Accessing bookmarks by name is only possible by browsing the bookmark names. WrdBookmark
returns a handle to a bookmark by taking its name as argument. WrdInsertBookmark
, WrdDeleteBookmark
inserts/deletes a bookmark in a Word document. WrdGotoBookmark
allows to place the cursor on the bookmark and WrdUpdateBookmark
replaces the content within the range of the bookmark in a Word document with the given text.
WrdBookmark(name, wrd = DescToolsOptions("lastWord")) WrdInsertBookmark(name, wrd = DescToolsOptions("lastWord")) WrdDeleteBookmark(name, wrd = DescToolsOptions("lastWord")) WrdGoto(name, what = wdConst$wdGoToBookmark, wrd = DescToolsOptions("lastWord")) WrdUpdateBookmark(name, text, what = wdConst$wdGoToBookmark, wrd = DescToolsOptions("lastWord"))
name |
the name of the bookmark. |
text |
the text of the bookmark. |
what |
a word constant, defining the type of object to be used to place the cursor. |
wrd |
the pointer to a word instance. Can be a new one, created by |
Bookmarks are useful to build structured documents, which can be updated later.
Andri Signorell <andri@signorell.net>
## Not run: # we can't get this through the CRAN test - run it with copy/paste to console wrd <- GetNewWrd() WrdText("a)\n\n\nb)", fontname=WrdGetFont()$name, fontsize=WrdGetFont()$size) WrdInsertBookmark("chap_b") WrdText("\n\n\nc)\n\n\n", fontname=WrdGetFont()$name, fontsize=WrdGetFont()$size) WrdGoto("chap_b") WrdUpdateBookmark("chap_b", "Goto chapter B and set text") WrdInsertBookmark("mybookmark") ToWrd("A longer text\n\n\n") # Now returning the bookmark bm <- WrdBookmark("mybookmark") # get the automatically created name of the bookmark bm$name() ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.