body_add_flextable_autofit: add a table into an rdocx object, with autofiting of width

Description Usage Arguments Value Author(s) Examples

View source: R/officer.r

Description

add a table into an rdocx object, with autofiting of width

Usage

1
2
body_add_flextable_autofit(x, value, align = "center", pos = "after",
  split = FALSE, landscape = FALSE)

Arguments

x

an rdocx object

value

flextable object

align

left, center (default) or right

pos

where to add the flextable relative to the cursor, one of "after", "before", "on" (end of line).

split

set to TRUE if you want to activate Word option 'Allow row to break across pages'.

landscape

is the table inserted in a landscape section? (default: FALSE)

Value

A new rdocx object

Author(s)

David Hajage

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
library(biostat2)
library(officer)
library(flextable)
mytable <- flextable(head(iris))
doc <- read_docx()
doc <- body_add_flextable(doc, mytable)
doc <- body_add_break(doc)
doc <- body_add_flextable_autofit(doc, mytable)
doc <- body_end_section_portrait(doc)
doc <- body_add_flextable(doc, mytable)
doc <- body_add_break(doc)
doc <- body_add_flextable_autofit(doc, mytable, landscape = TRUE)
doc <- body_end_section_landscape(doc)

print(doc, target = "toto.docx")

## End(Not run)

eusebe/biostat2 documentation built on Dec. 27, 2019, 4:22 p.m.