wb_add_marquee_text()
uses fmt_marquee_txt()
to add Markdown formatted
text to a Workbook. openxlsx2::wb_set_col_widths()
is applied to the
workbook to adjust widths for the specified columns. Set widths = NULL
to
disable this functionality.
Usage
wb_add_marquee_text(
wb = NULL,
text,
sheet = current_sheet(),
dims = NULL,
...,
cols = 1,
widths = "auto"
)
Arguments
- wb
A Workbook object containing a worksheet.
- text
A character string. The core quality of markdown is that any text is valid markdown so there is no restrictions on the content
- sheet
The worksheet to write to. Can be the worksheet index or name.
- dims
Spreadsheet cell range that will determine
start_col
andstart_row
: "A1", "A1:B2", "A:B"- ...
Arguments passed on to
fmt_marquee_txt
style
A style set such as
classic_style()
that defines how the text should be renderedignore_html
Should HTML code be removed from the output
- cols
Indices of cols to set/remove column widths.
- widths
Width to set
cols
to specified column width or"auto"
for automatic sizing.widths
is recycled to the length ofcols
. openxlsx2 sets the default width is 8.43, as this is the standard in some spreadsheet software. See Details for general information on column widths.
Examples
library(openxlsx2)
wb <- wb_workbook()
wb <- wb_add_worksheet(wb)
wb <- wb_add_marquee_text(
wb,
text = "
# Heading 1
Example text.
~~Strikethrough text~~
## Heading 2
- Bulleted list item 1
- Nested bullet
- Bulleted list item 2"
)
#> Error in purrr::pmap(parsed_text, function(text, type, indentation, indent, size, ol_index, weight, bullets, color, underline, strikethrough, ...) { before <- paste0(rep(" ", indent), collapse = "") if (type == "li") { bullet <- bullets[[indentation - 2]] before <- paste0(before, bullet, " ") } else if (ol_index > 0) { before <- paste0(before, ol_index, ". ") } openxlsx2::fmt_txt(x = paste0(before, text), bold = weight > 400, underline = underline, strike = strikethrough, size = size, color = color)}): ℹ In index: 1.
#> Caused by error:
#> ! color must be class wbColour