Table with "auto" colwidths is hidden when calling openXL or saveWorkbook twice
Opened this issue · 0 comments
jey1401 commented
Describe the bug
After setting column widths to "auto", table columns are hidden in Excel on second call to openXL (or saveWorkbook).
Warnings appear on second call.
To Reproduce
library(openxlsx)
wb = createWorkbook()
addWorksheet(wb, "test")
writeDataTable(wb, sheet = "test", iris)
setColWidths(wb, sheet = "test", cols = 1:5, widths = "auto")
openXL(wb) # ok
openXL(wb) # bug: table is hidden in Excel
#> Warning in .self$setColWidths(i): NAs introduced by coercion
#> Warning in .self$setColWidths(i): NAs introduced by coercion
#> Warning in .self$setColWidths(i): NAs introduced by coercion
#> Warning in .self$setColWidths(i): NAs introduced by coercion
#> Warning in .self$setColWidths(i): NAs introduced by coercion
Created on 2023-08-09 by the reprex package (v2.0.1)
Expected behavior
Table columns should be shown.
File should not change on successive calls to openXL or saveWorkbook.