You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wb <- loadWorkbook("testCorrupting.xlsx") #that has a sort as part of a filter
saveWorkbook(wb,"testCorrupted.xlsx", overwrite=TRUE)
open testCorrupted.xlsx - should not come up as corrupt.
Actual Behavior
open testCorrupted.xlsx - Excel says it is corrupted.
clearing the autoFilter field of the worksheet object before saving resolves it, but drops the filter and sort:
wb <- loadWorkbook("testCorrupting.xlsx") #that has a sort as part of a filter
wb[["worksheets"]][1][[1]][["autoFilter"]]
[1] "<autoFilter ref="A1:C1"><sortState ref="A2:C5"><sortCondition ref="B1"/>"
Expected Behavior
wb <- loadWorkbook("testCorrupting.xlsx") #that has a sort as part of a filter
saveWorkbook(wb,"testCorrupted.xlsx", overwrite=TRUE)
open testCorrupted.xlsx - should not come up as corrupt.
Actual Behavior
open testCorrupted.xlsx - Excel says it is corrupted.
clearing the autoFilter field of the worksheet object before saving resolves it, but drops the filter and sort:
wb <- loadWorkbook("testCorrupting.xlsx") #that has a sort as part of a filter
wb[["worksheets"]][1][[1]][["autoFilter"]]
[1] "<autoFilter ref="A1:C1"><sortState ref="A2:C5"><sortCondition ref="B1"/>"
wb[["worksheets"]][1][[1]][["autoFilter"]] <- character(0)
also the following works as it is only the sort that causes an issue:
wb[["worksheets"]][1][[1]][["autoFilter"]] <- "<autoFilter ref="A1:C1"/>
saveWorkbook(wb,"testCorrupted.xlsx", overwrite=TRUE)
Steps to Reproduce the Problem
(please attach an example xlsx file if possible)
testCorrupting.xlsx
Have a spreadsheet with a filter added and a column sorted as in testCorrupting.xlsx
do the following in R
wb <- loadWorkbook("testCorrupting.xlsx")
saveWorkbook(wb,"testCorrupted.xlsx", overwrite=TRUE)
sessionInfo()
The text was updated successfully, but these errors were encountered: