Appends content to the body of a word document

system_report_doc_add_content(
  cfg,
  rptname = "default",
  content_type = NULL,
  content = NULL
)

Arguments

cfg

ubiquity system object

rptname

report name initialized with system_report_init

content_type

name of the placeholder

content

list containing content to add

For each content type listed below the different content is expected. Text can be specified in different formats: "text" indicates plain text, "fpar" is formatted text defined by the fpar command from the officer package, and "md" is text formatted in markdown format (?md_to_officer for markdown details).

  • "break" page break, content is (NULL) and a page break will be inserted here

  • "toc" generates the table of contents, and content is a list

    • "level" number indicating the depth of the contents to display (3)

  • "text" content is a list containing a paragraph of text with the following elements

    • "text" string containing the text content either a string or the output of "fpar" for formatted text.

    • "style" string containing the style either "normal", "code", "h1", "h2", "h3"

    • "format" string containing the format, either "text", "fpar", or "md" (default NULL assumes "text" format)

  • "imagefile" content is a list containing information describing an image file with the following elements

    • image string containing path to image file

    • caption caption of the image (NULL)

    • caption_format string containing the format, either "text", "fpar", or "md" (default NULL assumes "text" format)

    • key unique key for cross referencing e.g. "FIG_DATA" (NULL)

    • height height of the image (NULL)

    • width width of the image (NULL)

  • "ggplot" content is a list containing an image from a ggplot object, (eg. p = ggplot() + ....) with the following elements

    • image ggplot object

    • caption caption of the image (NULL)

    • caption_format string containing the format, either "text", "fpar", or "md" (default NULL assumes "text" format)

    • key unique key for cross referencing e.g. "FIG_DATA" (NULL)

    • height height of the image (NULL)

    • width width of the image (NULL)

  • "table" content is a list containing the table content and other options with the following elements:

    • table data frame containing the tabular data

    • caption caption of the table (NULL)

    • caption_format string containing the format, either "text", "fpar", or "md" (default NULL assumes "text" format)

    • key unique key for cross referencing e.g. "TAB_DATA" (NULL)

    • header Boolean variable to control displaying the header (TRUE)

    • first_row Boolean variable to indicate that the first row contains header information (TRUE)

  • "flextable" content is a list containing flextable content and other options with the following elements (defaults in parenthesis):

    • table data frame containing the tabular data

    • caption caption of the table (NULL)

    • caption_format string containing the format, either "text", "fpar", or "md" (default NULL assumes "text" format)

    • key unique key for cross referencing e.g. "TAB_DATA" (NULL)

    • header_top, header_middle, header_bottom (NULL) a list with the same names as the data frame names containing the tabular data and values with the header text to show in the table

    • header_format string containing the format, either "text", or "md" (default NULL assumes "text" format)

    • merge_header (TRUE) Set to true to combine column headers with the same information

    • table_body_alignment, table_header_alignment ("center") Controls alignment

    • table_autofit (TRUE) Automatically fit content, or specify the cell width and height with cwidth (0.75) and cheight (0.25)

    • table_theme ("theme_vanilla") Table theme

  • "flextable_object" content is a list specifying the a user defined flextable object with the following elements:

    • ft flextable object

    • caption caption of the table (NULL)

    • key unique key for cross referencing e.g. "TAB_DATA" (NULL)

Value

cfg ubiquity system object with the content added to the body