pivottabler (version 1.5.0)

PivotOpenXlsxRenderer: R6 class that renders a pivot table into an Excel worksheet.

Description

The `PivotOpenXlsxRenderer` class creates a representation of a pivot table in an Excel file using the `openxlsx` package. See the "Excel Export" vignette for details and examples.

Arguments

Format

R6Class object.

Methods

Public methods

Method new()

Create a new `PivotOpenXlsxRenderer` object.

Usage

PivotOpenXlsxRenderer$new(parentPivot)

Arguments

parentPivot

The pivot table that this `PivotOpenXlsxRenderer` instance belongs to.

Returns

A new `PivotOpenXlsxRenderer` object. An internal method used when rendering a pivot table to HTML. Clear the IsRendered flags that exist on the `PivotDataGroup` class.

Method clearIsRenderedFlags()

Usage

PivotOpenXlsxRenderer$clearIsRenderedFlags()

Returns

No return value.

Method writeToCell()

Writes a value to a cell and applies styling as needed.

Usage

PivotOpenXlsxRenderer$writeToCell(
  wb = NULL,
  wsName = NULL,
  rowNumber = NULL,
  columnNumber = NULL,
  value = NULL,
  applyStyles = TRUE,
  baseStyleName = NULL,
  style = NULL,
  mapFromCss = TRUE,
  mergeRows = NULL,
  mergeColumns = NULL
)

Arguments

wb

A `Workbook` object representing the Excel file being written to.

wsName

A character value specifying the name of the worksheet to write to.

rowNumber

An integer value specifying the row number of the cell to write to.

columnNumber

An integer value specifying the column number of the cell to write to.

value

The value to write into the cell.

applyStyles

Default `TRUE` to write styling information to the cell.

baseStyleName

A character value specifying a named style defined in the pivot table.

style

A `PivotStyle` object containing CSS style declarations to override the base style.

mapFromCss

Default `TRUE` to automatically convert CSS style declarations to their Excel equivalents.

mergeRows

An integer vector specifying the row extent of a merged cell.

mergeColumns

An integer vector specifying the column extent of a merged cell.

Returns

No return value.

Method writeToWorksheet()

Write the pivot table into the specified workbook and worksheet at the specified row-column location.

Usage

PivotOpenXlsxRenderer$writeToWorksheet(
  wb = NULL,
  wsName = NULL,
  topRowNumber = NULL,
  leftMostColumnNumber = NULL,
  outputHeadingsAs = "formattedValueAsText",
  outputValuesAs = "rawValue",
  applyStyles = TRUE,
  mapStylesFromCSS = TRUE,
  exportOptions = NULL,
  showRowGroupHeaders = FALSE
)

Arguments

wb

A `Workbook` object representing the Excel file being written to.

wsName

A character value specifying the name of the worksheet to write to.

topRowNumber

An integer value specifying the row number in the Excel worksheet to write the pivot table.

leftMostColumnNumber

An integer value specifying the column number in the Excel worksheet to write the pivot table.

outputHeadingsAs

Must be one of "rawValue", "formattedValueAsText" (default) or "formattedValueAsNumber" to specify how data groups are written into the Excel sheet.

outputValuesAs

Must be one of "rawValue" (default), "formattedValueAsText" or "formattedValueAsNumber" to specify how cell values are written into the Excel sheet.

applyStyles

Default `TRUE` to write styling information to the cell.

mapStylesFromCSS

Default `TRUE` to automatically convert CSS style declarations to their Excel equivalents.

exportOptions

A list of additional export options - see the "A1. Appendix" for details.

showRowGroupHeaders

Default `FALSE`, specify `TRUE` to write row group headers.

Returns

No return value.

Method clone()

The objects of this class are cloneable with this method.

Usage

PivotOpenXlsxRenderer$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code
# NOT RUN {
# This class should only be created by the pivot table.
# It is not intended to be created outside of the pivot table.
# }

Run the code above in your browser using DataCamp Workspace