diff --git a/R/utils.R b/R/utils.R index f773622f9..75f6e9dfd 100644 --- a/R/utils.R +++ b/R/utils.R @@ -930,7 +930,7 @@ fmt_txt <- function( } xml_t_attr <- if (grepl("(^\\s+)|(\\s+$)", x)) c("xml:space" = "preserve") else NULL - xml_t <- xml_node_create("t", xml_children = x, xml_attributes = xml_t_attr) + xml_t <- xml_node_create("t", xml_children = replace_legal_chars(x), xml_attributes = xml_t_attr) xml_rpr <- xml_node_create( "rPr", diff --git a/man/wb_add_formula.Rd b/man/wb_add_formula.Rd index a0db878dc..2a1545cd3 100644 --- a/man/wb_add_formula.Rd +++ b/man/wb_add_formula.Rd @@ -61,7 +61,6 @@ The examples below show a small list of possible formulas: \item MAX(B2:B4) \item ... } - } \examples{ wb <- wb_workbook()$add_worksheet() diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index a7ffd2cef..0eb564de5 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -399,4 +399,13 @@ test_that("fmt_txt works", { got <- as.character(txt) expect_equal(exp, got) + txt <- fmt_txt("0 < 1", bold = TRUE) + exp <- "0 < 1" + got <- as.character(txt) + expect_equal(exp, got) + + exp <- "0 < 1" + got <- unclass(txt) + expect_equal(exp, got) + })