rtfWriteOutTableText
DESCRIPTION:
Writes out the given data frame of text to the given RTF file.
USAGE:
rtfWriteOutTableText(dfText, rtfFile, tableInit, idText, titl, tableColumnsHeader,
sortCol, summStartRow, maxColumnsPage, maxRowsPage,
colHeadRowTop = SOLIDCELLBORDER, colHeadRowBot = SOLIDCELLBORDER,
tableHeader = NULL,
cellBorder = rep(list(rep(NOCELLBORDER, 4)), tableInit$numCols),
tableStyle = TableText10Style, tableHeaderStyle = TableHeader10Style,
contTitlTxt = "", wrapRightBorder = DASHCELLBORDER,
wrapBotBorder = DASHCELLBORDER, tableCaptionStyle = CaptionStyle,
tableCaptionStyleCont = NonCaptionStyle, bkmarkIn = "",
repeatItems = list(row = numeric(), column = numeric()),
spaceStyle = NonCaptionStyle, tablejust = "")
ARGUMENTS:
- dfText
-
Data frame with text to output as RTF table (no default).
- rtfFile
-
rtfFile to write the output to (no default).
- tableInit
-
List with information about the table produced by rtfTableInit (no default).
- idText
-
Text specifying identifying information for caption (e.g. ST-) (no default).
- sortCol
-
Vector of which columns should be included on each page (identifying columns).
- titl
-
Title for table caption; the title is repeated on each page but on the first page is the caption for the table.
- tableColumnsHeader
-
Column headers for the main table.
- summStartRow
-
Number that specifies the row on which summary information
starts in dfText; value should be 0 if no such summary information exists.
- maxColumnsPage
-
Maximum number of columns for table that should be put on a page
used to determine when table should wrap.
- maxRowsPage
-
Maximum number of rows for a table that should be put on a page.
- colHeadRowTop
-
Border for the top of the column header row (default=SOLIDCELLBORDER).
- colHeadRowBot
-
Border for the bottom of the column header row (default=SOLIDCELLBORDER).
- tableHeader
-
list of table headers for the table; each table header needs to have a
colHeader-text values for header, colspans-columns that are spaned by header,
cellBorder-cell border for table; colspans can have one "*" which means use all other
columns in this column. Example: list(list(colHeader=c("", "Protocol Time (h)"), colspans=c(1,"*"),
cellBorder=rep(list(rep(NOCELLBORDER,4)), 2))))
- cellBorder
-
Used when need different border on each cell; values are overriden by rowxxx
parameters; list of vectors for each cell going clockwise in the following order -
c(left,top,right,bottom); the values should be the RTF text to be used for each border
and contain one entry for each cell; predefined border values are NOCELLOBORDER,
SOLIDCELLBORDER and DASHCELLBORDER (default=rep(list(rep(NOCELLBORDER,4)), tableInit$numCols))
- tableStyle
-
Document test style to use for text within the table (default=TableText10Style)
- tableHeaderStyle
-
RTF style to use for table header (default=TableHeader10Style)
- contTitlTxt
-
Text to add to title if continuation (default="")
- wrapRightBorder
-
Cell border to use for wrapping on right (default=DASHCELLBORDER)
- wrapBotBorder
-
Cell border to use for wrapping on bottom (default=DASHCELLBORDER)
- tableCaptionStyle
-
Style for the table caption (default=CaptionStyle)
- tableCaptionStyleCont
-
Style for the table caption continuation (default=NonCaptionStyle)
- bkmarkIn
-
Used to signify that the table is actually a continuation if not blank (default="")
- repeatItems
-
List with row and column that determines which information within the table
is to be repeated on tables that wrap (default=list(row=numeric(), column=numeric()))
- tablejust
-
Table justification (e.g. \\trqc for centered) (default="")
VALUE:
Returns bookmark for the table, so it can be used in another reference
AUTHOR(S):
TIBCO Software Inc.
EXAMPLES:
library(rtftools)
rtfFile <- "mytest.rtf"
cat(file=rtfFile, rtfInit(bLandscape=T), append=F)
# create sample data.frame
mydf <- data.frame(myCol1=format(rnorm(20), digits=3, justify="n"),
myCol2=format(rnorm(20), digits=3, justify="n"),
myCol3=format(rnorm(20), digits=3, justify="n"),
myCol4=format(rnorm(20), digits=3, justify="n"), stringsAsFactors=F)
tableInit <- rtfTableInit(ncol(mydf), colwidth=rep(1000, ncol(mydf)), fontsize=10)
rtfWriteOutTableText(mydf, rtfFile, tableInit, "Table ", titl="Test splitting of table across pages",
dimnames(mydf)[[2]], sortCol="myCol1", summStartRow=0,
maxColumnsPage=3, maxRowsPage=10,
tableHeader=NULL,
cellBorder=rep(list(rep(SOLIDCELLBORDER,4)), tableInit$numCols))
rtfClose(rtfFile)