
Last chance! 50% off unlimited learning
Sale ends in
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"))
the name of the bookmark.
the text of the bookmark.
a word constant, defining the type of object to be used to place the cursor.
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")
.
Bookmarks are useful to build structured documents, which can be updated later.
# 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()
# }
Run the code above in your browser using DataLab