Open tobwen opened 5 years ago
I want to set MS Excel's default column width to 10.71 (80 px) for all columns in a worksheet.
minWidth is ignored or can't be used as a default min-width
options("openxlsx.minWidth" = 10.71) wb <- createWorkbook() addWorksheet(wb, "test") freezePane(wb, sheet = 1, firstRow = TRUE) setColWidths(wb, sheet = 1, cols = 1:ncol(data), widths = "auto") saveWorkbook(wb, tempfile(), overwrite = TRUE)
Hack, which creates much bigger files: setColWidths(wb, sheet = 1, cols = ncol(data):16384, widths = 10.71)
setColWidths(wb, sheet = 1, cols = ncol(data):16384, widths = 10.71)
https://github.com/awalker89/openxlsx/blob/ead0038c59a227faa5c03f13aa7c6211f63dc9e0/R/worksheet_class.R#L55
change
<sheetFormatPr defaultRowHeight="15.0"/>
to
<sheetFormatPr defaultRowHeight="15.0" baseColWidth="10"/>
Expected Behavior
I want to set MS Excel's default column width to 10.71 (80 px) for all columns in a worksheet.
Actual Behavior
minWidth is ignored or can't be used as a default min-width
Steps to Reproduce the Problem
Hack, which creates much bigger files:
setColWidths(wb, sheet = 1, cols = ncol(data):16384, widths = 10.71)
sessionInfo()