openxlsx icon indicating copy to clipboard operation
openxlsx copied to clipboard

deleteData doesn't delete styles even though help function says so

Open deschen1 opened this issue 3 years ago • 1 comments

Using ?deleteData says "Delete contents and styling from a cell."

However, this doesn't seem to be the case:

wb <- createWorkbook()
addWorksheet(wb, "Iris")
writeData(wb, "Iris", iris)

my_style <- createStyle(bgFill = "#252525")
addStyle(wb, "Iris", my_style, cols = 1, rows = 1:dim(iris)[1],gridExpand = TRUE)
saveWorkbook(wb, file = "test.xlsx", overwrite = TRUE)

Opening this Excel file shows that column 1 is entirely black.

deleteData(wb, sheet = "Iris", cols = 1, rows = 2:5, gridExpand = TRUE)
saveWorkbook(wb, file = "test.xlsx", overwrite = TRUE)

This is supposed to delete the data and background color/styles from first column, row 2:5. And while the data is indeed deleted, the styling is not.

deschen1 avatar Jan 20 '22 12:01 deschen1

I can confirm this issue using the code provided, and I've also noticed this in some of my own code as well.

xIncubakerx avatar Feb 02 '22 01:02 xIncubakerx

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Feb 04 '23 02:02 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Feb 11 '23 02:02 github-actions[bot]