WrdTableHeading.RdInserting headings in a table can be hard, when column headings should span several columns. This function helps to easily insert headings and merge cells.
WrdTableHeading(wtab, text, bold = TRUE,
alignment = wdConst$wdAlignParagraphCenter,
merge_cols = NULL, wrd = DescToolsOptions("lastWord"))the handle to a table in a word document
the text for the headings
logical, for setting bold column headings, will be recycled. Default is TRUE.
the alignment in the column headings, must be one out of the Word constant list wdConst$wdAlignParagraph.
a vector consisting of entries to merge cells in the form "<first cell>:<last cell>", example merge_cols=c("2:4", "7:8") would merge the column headings 2:4 to one cell and 7:8 as well.
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").
Nothing returned.
if (FALSE) # Windows-specific example
wrd <- GetNewWrd()
wtab <- WrdTable(nrow=3, ncol=5, wrd=wrd)
#> Error: object 'wrd' not found
# insert headings and merge 1:2 and 4:5, such as there are
# only 3 headings
WrdTableHeading(wtab, text=c("First","Second",
"Third"),
alignment=c(wdConst$wdAlignParagraphLeft,
rep(wdConst$wdAlignParagraphCenter, 2)),
merge_cols = c("1:2", "4:5"))
#> Error: object 'wtab' not found
# \dontrun{}