Learn R Programming

rtables (version 0.6.0)

export_as_rtf: Export table to RTF

Description

Experimental export to the RTF format.

Usage

export_as_rtf(
  tt,
  file = NULL,
  colwidths = propose_column_widths(matrix_form(tt, TRUE)),
  page_type = "letter",
  pg_width = page_dim(page_type)[if (landscape) 2 else 1],
  pg_height = page_dim(page_type)[if (landscape) 1 else 2],
  landscape = FALSE,
  margins = c(bottom = 4, left = 4, top = 4, right = 4),
  font_size = 8,
  font_family = "Courier",
  ...
)

Arguments

tt

TableTree (or related class). A TableTree object representing a populated table.

file

character(1). File to write.

colwidths

numeric vector. Column widths for use with vertical pagination.

page_type

character(1). Name of a page type. See page_types. Ignored when pg_width and pg_height are set directly.

pg_width

numeric(1). Page width in inches.

pg_height

numeric(1). Page height in inches.

landscape

logical(1). Should the dimensions of page_type be inverted for landscape? Defaults to FALSE, ignored when pg_width and pg_height are set directly.

margins

A numeric vector interpreted in the same way as par(mar) in base graphics.

font_size

numeric(1). Font size, defaults to 12.

font_family

character(1). Name of a font family. An error will be thrown if the family named is not monospaced. Defaults to Courier.

...

Passed directly to paginate_table

Details

RTF export occurs by via the following steps

  • the table is paginated to the page size (Vertically and horizontally)

  • Each separate page is converted to a MatrixPrintForm and from there to RTF-encoded text

  • Separate rtfs text chunks are combined and written out as a single RTF file

Conversion of MatrixPrintForm objects to RTF is done via formatters::mpf_to_rtf().