我正在尝试以某种格式构建 excel xlsx 工作簿的标题。有些字符串太大,需要包裹起来。
但是当我使用strwrap添加\n字符时,setHeaderFooter 告诉我我有三个以上的参数
例如:
require (openxlsx)
require (tidyverse)
wb0 <- createWorkbook()
addWorksheet(wb0, "Sheet 1")
label <- "&B EJECUTIVOS DE CUENTA: &B"
value <- "FANARA ARIEL GUSTAVO:476, BARETTO ANA SILVINA:34, NO APLICA:32, SANTOS MAXIMILIANO ARIEL:21, AVILA ROBERTO:19, REGGI PABLO:9, Otros:51"
setHeaderFooter (
wb0, sheet = 1
, header = c (
# "left side / izquierda"
strwrap (
x = paste0 (
label, " "
, substr (value, start = 1, stop = 360)
)
, width = 45
, prefix = "\n", initial = ""
)
, "center header / centro"
, "rigth side / derecha"
)
, footer = c (
"&[Date]"
, NA
, "&[File]"
)
)