as_flextable: Convert a huxtable for Word/Powerpoint

Description Usage Arguments Details Value Challenge Examples

View source: R/flextable.R

Description

Huxtables can be converted to flextable::flextable() objects, for use in Word and Powerpoint documents.

Usage

1
2
3
4
as_flextable(x, ...)

## S3 method for class 'huxtable'
as_flextable(x, colnames_to_header = FALSE, ...)

Arguments

x

A huxtable.

...

Not used.

colnames_to_header

Use huxtable column names as the header. If FALSE, the flextable will contain only a body and no header.

Details

With recent versions of "flextable" and Pandoc, huxtables can be automatically outputted from rmarkdown word_document and/or powerpoint_presentation documents. (Powerpoint presentations require pandoc version >= 2.4.0.)

Properties are supported, with the following exceptions:

Value

an object of class flextable.

Challenge

Try to say as_flextable.huxtable ten times without pausing.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ht <- hux(a = 1:3, b = 1:3)
ft <- as_flextable(ht)
## Not run: 
  my_doc <- officer::read_docx()
  my_doc <- flextable::body_add_flextable(
        my_doc, ft)
  print(my_doc, target =
        "path/to/my_doc.docx")

## End(Not run)

huxtable documentation built on Feb. 15, 2021, 1:07 a.m.