How do I autofit the column width using openxlsx
?
One of my columns has a date variable (eg. 21-08-2017
) and if copied using ctrl+c
from Excel, and pasted normally elsewhere, it shows like #######
(if column width is increased to show the content in Excel, it pastes normally). I want to integrate that repeatitive task into my code. Here is what I am using right now:
WB <- loadWorkbook(File)
addWorksheet(WB, Sheet)
writeDataTable(WB, Sheet, DF, withFilter=F, bandedRows=F, firstColumn=T)
saveWorkbook(WB, File, overwrite =TRUE)
I have attached the whole relevant code here, I am also doing conditional formatting based on the table values. Please suggest an way to integrate autofit column width in here.
EDIT: By default, XLSX outputs from R has the default 8.43 columnwidth, I want to either set it to autofit as per cell contents, or set it manually for each column.
To Mod: This is a problem I am trying to solve in R, using openxlsx. Anyway, thanks for the attention.