Insert a FlexTable into a document object

FlexTable can be manipulated so that almost any formatting can be specified. See FlexTable for more details.

addFlexTable(doc, flextable, ...)

# S3 method for docx
par.properties = parProperties(text.align = "left"), bookmark, ...)

# S3 method for pptx
addFlexTable(doc, flextable, offx, offy, width, height, ...)

Arguments

doc
document object
flextable
the FlexTable object
...
further arguments passed to other methods
par.properties
paragraph formatting properties of the paragraph that contains the table. An object of class parProperties. Only alignment will be used, if you'd like to add space around a table, specify padding on preceding and or following paragraph.
bookmark
a character vector specifying bookmark id (where to put the table). If provided, table will be add after paragraph that contains the bookmark. If not provided, table will be added at the end of the document.
offx
optional, x position of the shape (top left position of the bounding box) in inches. See details.
offy
optional, y position of the shape (top left position of the bounding box) in inches. See details.
width
optional, width of the shape in inches. See details.
height
optional, height of the shape in inches. See details.

Value

a document object

Details

When document is a pptx object, two positioning methods are available.

If arguments offx, offy, width, height are missing, position and dimensions will be defined by the width and height of the next available shape of the slide. This dimensions can be defined in the layout of the PowerPoint template used to create the pptx object.

If arguments offx, offy, width, height are provided, they become position and dimensions of the new shape.

FlexTable, docx , pptx

Examples


options( "ReporteRs-fontsize" = 11 )
ft_obj <- vanilla.table(mtcars)

# docx example -----
doc = docx( )
doc = addFlexTable( doc, flextable = ft_obj )
writeDoc( doc, file = "add_ft_ex.docx" )

# pptx example -----
doc = pptx( )
doc = addSlide( doc, slide.layout = "Title and Content" )
doc = addFlexTable( doc, flextable = ft_obj )
writeDoc( doc, file = "add_ft_ex.pptx" )