R: Insert table in template table using ReporteRs -



R: Insert table in template table using ReporteRs -

i in process of making dashboard. basically, pulling out selected info database want display in word template. set template table (2 rows, 3 columns). in each cell set bookmark. then, using r bundle reporters set specific info r cell within template based on bookmark.

issue: cant seem insert tables cell of template.

tried: thought might due size of table (as experienced size issue when inserting figures), not case.

below illustration error. in order run have create word document table bookmark in 1 of cells called 'test'.

doc = docx( title = "dashboard",template="h:\\test.docx") myt <-flextable(cars[c(1:10),]) doc <-addflextable(doc,myt,bookmark="test") writedoc(doc, "h:\\testresult.docx")

if create bookmark outside of table , assign table new bookmark, seems work.

does know how insert table (data frame table) cell of template?

if argument bookmark used, content (plots, paragraphs or images) replace whole paragraph containing bookmark.

behavior different tables: tables added after paragraph contains bookmark. workaround add together paragraph after bookmarked paragraph in cell of template. utilize deletebookmark delete paragraph containing bookmark.

doc <- docx( title = "dashboard",template="h:\\test.docx") myt <- flextable(cars[c(1:10),]) # create sure there 1 new paragraph after paragraph contains 'test' # add together flextable after paragraph containing bookmark 'test' doc <- addflextable(doc,myt,bookmark="test") # delete paragraph containing bookmark 'test' deletebookmark(doc, bookmark= "test") writedoc(doc, "h:\\testresult.docx")

you may utilize sections columns instead (and column breaks):

doc = docx( ) doc = addsection(doc, landscape = true, ncol = 2 ) doc = addplot( doc = doc, fun = function() { barplot( 1:8, col = 1:8 ) }, width = 3, height = 3, pointsize = 5) doc = addcolumnbreak(doc ) doc = addflextable(doc, flextable(head(iris) ) )

r reporters

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -