set_html: Define the HTML specific properties of a StyledTable class...

set_html_rowheaderR Documentation

Define the HTML specific properties of a StyledTable class object

Description

The following functions allow to configure the html output behaviour of a StyledTable class object:

  • set_html_table_id() or remove_html_table_id(): Assign or remove an html id to the surrounding ⁠<table>⁠ tag

  • set_html_table_class() or remove_html_table_class(): Append or remove an html class name to the surrounding ⁠<table>⁠ tag

  • set_html_tr_class() or remove_html_tr_class(): Append or remove an html class name to the ⁠<tr>⁠ tag of one ore more table rows

  • set_html_td_class() or remove_html_td_class(): Append or remove an html class name to one or more table cells (⁠<td>⁠ or ⁠<th>⁠ tags)

  • set_html_td_id(): Assign an html id to one ore more table cells (⁠<td>⁠ or ⁠<th>⁠ tags)

  • set_html_colheader(): Define one or more table rows as header rows, holding the headings of the columns

  • set_html_rowheader(): Define one or more table columns as header columns, holding additional headings for the rows

  • set_html_subheading(): Define one or more table rows as subheading rows, grouping the html table into smaller tables

  • set_html_pre_process(): Add an html specific pre-processing function to one or more table cells. This functions will modify the cell values, when create_html() is called.

  • apply_html_theme1(): Assign the html class styledtable-theme1 to the ⁠<table>⁠ tag. This will ensure that the styling defined in styledTables/inst/stylesheets/sass_files/styledtable_theme1.sass is used. If you want to create your own html stylings, then you should have a look at this sass file and create your own stylesheets (sass or css). Note that you can either include your own stylesheets in the css field in the output-format section of the yaml header of your rmd file (sass and css files are both possible) or you can add your stylesheet as html dependency by calling add_html_stylesheet()

  • add_html_dependency(): Adds an html dependency (stylesheet, javascript etc.) to your styledTable object. When the table is printed, then these dependencies will automatically be included in the resulting html header.

  • add_html_stylesheet(): A wrapper for add_html_dependency() for adding css (holding costom html stylings for your tables) to the dependencies list of the StyledTable class object.

Usage

set_html_rowheader(st, col_id = NULL)

set_html_colheader(st, row_id = NULL)

set_html_subheading(st, row_id = NULL)

set_html_table_class(st, class, replace_mode = "append")

remove_html_table_class(st, class)

set_html_table_id(st, id, replace_mode = "append")

remove_html_table_id(st, id)

set_html_tr_class(st, class, row_id = NULL, replace_mode = "append")

remove_html_tr_class(st, class, row_id = NULL)

set_html_td_class(
  st,
  class,
  row_id = NULL,
  col_id = NULL,
  replace_mode = "append"
)

set_html_td_id(st, id, row_id = NULL, col_id = NULL, replace_mode = "append")

remove_html_td_class(st, class, row_id = NULL, col_id = NULL)

add_html_stylesheet(
  st,
  file_path,
  name = "additional_stylesheets",
  version = "0"
)

add_html_dependency(st, dep)

apply_html_theme1(st)

Arguments

st

A StyledTable class object

col_id

A numeric vector holding the ids of the specified table columns.

row_id

A numeric vector holding the ids of the specified table rows.

class

A character vector holding the html class names, which should be added to the specific dom element

replace_mode

One of the following strings:

  • "append": Append the value to already assigned values.

  • "replace": Replace already assigned values by the current value.

id

A character vector holding one or more html ids which should be assigend to the specific dom element.

file_path

The path to the css file holding the table styling.

name

A string holding the library name (has no effect on the output).

version

A string holding the version of the stylesheet (has no effect on the output)

dep

An html dependecy created by htmltools::htmlDependency()


R-package/styledTables documentation built on Feb. 6, 2024, 2:21 a.m.