wb_add_numfmt: Modify number formatting in a cell region

View source: R/class-workbook-wrappers.R

wb_add_numfmtR Documentation

Modify number formatting in a cell region

Description

Add number formatting to a cell region. You can use a number format created by create_numfmt().

Usage

wb_add_numfmt(wb, sheet = current_sheet(), dims = "A1", numfmt)

Arguments

wb

A Workbook

sheet

the worksheet

dims

the cell range

numfmt

either an id or a character

Details

The list of number formats ID is located in the Details section of create_cell_style().

Value

The wbWorkbook object, invisibly.

See Also

Other styles: wb_add_border(), wb_add_cell_style(), wb_add_fill(), wb_add_font(), wb_add_named_style(), wb_cell_style

Examples

wb <- wb_workbook() %>% wb_add_worksheet("S1") %>% wb_add_data("S1", mtcars)
wb %>% wb_add_numfmt("S1", dims = "F1:F33", numfmt = "#.0")
# Chaining
wb <- wb_workbook()$add_worksheet("S1")$add_data("S1", mtcars)
wb$add_numfmt("S1", "A1:A33", numfmt = 1)

openxlsx2 documentation built on Oct. 18, 2024, 1:07 a.m.