Hello List,

Does anyone have examples of custom formatting of tables in odfweave? I know
there is an example of this in the formatting.odt file that comes with the
package, but running that through odfweave gives the following error:

Error:  chunk 13 (label=showTableStyles)
Error in names(x) <- value :
  'names' attribute [1] must be the same length as the vector [0]

What I am really trying to do is replicate this part which highlights one
row

<<modTableStyles>>=
bigState <- which.max(tableData[, "Area"])
tableStyles$text[bigState,] <- "ArialHighlight"
tableStyles$cell[bigState,] <- "highlight"
tableStyles$text
@

In my code I do:

<<modtablestyles, echo=FALSE>>=
  bluesYes <- which(outTable[,2] >= 3 & outTable[,2] < 4)
  namel <- colnames(outTable)
  tstyles <- tableStyles(outTable, useRowNames = F, header = namel)
  tstyles$cell[bluesYes,2] <- "highlight"
@
<<corrTable,echo=FALSE,results=xml>>=
  odfTable(outTable, styles = tstyles, useRowNames = F, colnames = namel)
@

My code runs and does not throw an error, but the resulting table does not
have the rows I asked for highlighted. If I check the tableStyles object the
values of $cell are properly set as I want. What are valid values that
tableStyles$cell can be set to? Does this have to be a custom style defined
in the ODT file beforehand?

Thanks in advance,


Colin Robertson

PhD Candidate
Dept of Geography
University of Victoria

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to