Skip to contents

Experimental export to the RTF format.

Usage

export_as_rtf(
  x,
  file = NULL,
  colwidths = propose_column_widths(matrix_form(x, 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 = 0.5, left = 0.75, top = 0.5, right = 0.75),
  font_size = 8,
  font_family = "Courier",
  ...
)

Arguments

x

ANY. The table-like object to export. Must have an applicable matrix_form method.

file

character(1) or NULL. If non-NULL, the path to write a text file to containing the x rendered as ASCII text,

colwidths

numeric vector. Column widths (in characters) 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

numeric(4). Named numeric vector containing 'bottom', 'left', 'top', and 'right' margins in inches. Defaults to .5 inches for both vertical margins and .75 for both horizontal margins.

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 to individual methods.

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 mpf_to_rtf().