awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
365 stars 78 forks source link

Error when saving a Workbook with comments #486

Open Iris-and-the-machines opened 5 years ago

Iris-and-the-machines commented 5 years ago

Hi, I am having issues when trying to save a workbook with comments (see below for a reproducible example). I'd be happy if I could get some help on this!

Thanks a lot Iris

Expected Behavior

Simply loading a workbook with comments and saving it again including the comments. Ideally I would like to do s.th. in-between, but the error already appears when trying to save a workbook with comments.

Actual Behavior

When saving the workbook I get:

Error in comment_list[[i]]$style[[j]] : subscript out of bounds

This doesn't happen when using a file without comments.

Steps to Reproduce the Problem

Example file: saveWorkbookExample.xlsx

wb <- loadWorkbook("saveWorkbookExample.xlsx")

saveWorkbook(wb,  "saveWorkbookExample2.xlsx")

sessionInfo()

AlexSiormpas commented 5 years ago

Same problem here!

laubwolf commented 5 years ago

Possibly related to #365

Iris-and-the-machines commented 5 years ago

I found a workaround for the problem: For me the problem stems from Excel changing from "notes" to "threaded comments":

[(https://support.office.com/en-us/article/the-difference-between-threaded-comments-and-notes-75a51eec-4092-42ab-abf8-7669077b7be3)]

As soon as I switch from comments to old school notes everything seems to work.

Not a fix, but at least a way to still use the function.