new document |
wrd[["Documents"]]$Add(template, FALSE, 0) , template is the templatename. |
open |
wrd[["Documents"]]$Open(Filename="C:/MyPath/MyDocument.docx") . |
save |
wrd$ActiveDocument()$SaveAs2(FileName="P:/MyFile.docx") |
quit word |
wrd$quit() |
kill word task |
WrdKill kills a running word task (which might not be ended with quit.) |
normal text |
Use ToWrd which offers many arguments as fontname, size, color, alignment etc. |
|
ToWrd("Lorem ipsum dolor sit amet, consetetur", |
|
font=list(name="Arial", size=10, col=wdConst$wdColorRed) |
simple text |
sel$TypeText("sed diam nonumy eirmod tempor invidunt ut labore") |
heading 1 |
WrdCaption("My Word-Story", stylename = wdConst$wdStyleHeading1) |
heading 2 |
WrdCaption("My Word-Story", stylename = wdConst$wdStyleHeading2) |
insert R output |
ToWrd(capture.output(str(d.diamonds))) |
pagebreak |
sel$InsertBreak(wdConst$wdPageBreak) |
move cursor right |
sel$MoveRight(Unit=wdConst$wdCharacter, Count=2, Extend=wdConst$wdExtend) |
goto end |
sel$EndKey(Unit=wdConst$wdStory) |
pagesetup |
sel[["PageSetup"]][["Bottommargin"]] <- 4 * 72 |
add bookmark |
wrd[["ActiveDocument"]][["Bookmarks"]]$Add("myBookmark") |
goto bookmark |
sel$GoTo(wdConst$wdGoToBookmark, 0, 0, "myBookmark") |
show document map |
wrd[["ActiveWindow"]][["DocumentMap"]] <- TRUE |
create table |
WrdTable () which allows to define the table's geometry |
insert caption |
sel$InsertCaption(Label="Abbildung", TitleAutoText="InsertCaption", |
|
Title="My Title") |
tables of figures |
wrd$ActiveDocument()$TablesOfFigures()$Add(Range=sel$range(), |
|
Caption="Abbildung") |
createCOMReference is just a wrapper for RDCOMClient::createCOMReference, as the function is not visible, if RDCOMClient is only used by required namespace.