ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
220 stars 74 forks source link

fix: Avoid adding an <sheetPr></sheetPr> when not needed #409

Closed retostauffer closed 1 year ago

retostauffer commented 1 year ago

Replaces pull request https://github.com/ycphs/openxlsx/pull/404

Thanks you very much @JanMarvin for your reply and your insights (https://github.com/ycphs/openxlsx/pull/404). It made me curious why there is a nested <sheetPr> tag. Adjusted my pull request; now checking if there is any <sheetPr> or <sheetPr ...>. If not, it would be added.

Testing

I have tested the change following the minimal posted in issue https://github.com/ycphs/openxlsx/issues/403

Under all circumstances openxlsx::read.xlsx, readxl::read_excel, Libreoffice, as well as Excel were able to read the sheets as expected.

Thanks a lot!

retostauffer commented 1 year ago

@ycphs sorry for the late response. Works like a charm with openxlsx >= 4.2.5.900. Thanks for all your work and adding the fix!