-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wb_load()
throws error if worksheets have "freeze panes" activated
#494
Comments
Hi @omertayyab , I can not confirm this with openxlsx2 0.4.1. Do you use the current release? [Edit:] I assume you have uploaded the file after your repairs, could you see if you can create a file that causes the bug? library(openxlsx2)
fl <- "~/Downloads/LFS_data.xlsx"
wb <- wb_load(fl)$save("/tmp/test.xlsx")
# xl_open("/tmp/test.xlsx") [Edit2:] I assume the error is caused by multiple sheetViews entries, but from the documentation I was unable to guess how they are constructed. |
Hi @omertayyab , a potential fix is in #495. Could you please check if this works with your file? As explanation what is going on, if we split the sheetview with fixed cells and with a split workbook view we end up with something like: <sheetView tabSelected="1" workbookViewId="0">
<pane xSplit="7320" ySplit="1640"/>
<selection pane="topRight"/>
<selection pane="bottomLeft"/>
<selection pane="bottomRight" activeCell="C5" sqref="C5"/>
</sheetView> Our code looked for all elements in sheetView and started to extract them. Though this results in two errors. 1) The names are not unique and 2) our function expects the entire content as a single string. Not as four strings. This export is a bit borked for other reasons. If we create a freezePane ourselfs we will erase whatever we have in Thanks for the report! I'll guess this will be merged into |
Hey @JanMarvin, thanks for the guidance, I used the following command to re-install the package from the This seems to have resolved the loading issue :) |
Edit 01: Replaced file that has the
SheetView
elements present. Earlier upload didn't have these elementswb_load
is unable to create a workbook object if.xlsx
file has frozen panes. Once those panes are unfrozen, the function works. The error thrown is:the sheetViews element wasn't present in the main
xl/workbook.xml
but it was present in the individual sheet.xml
files. Once I deleted the elements from the.xml
, the function started working. Removing can be done via directly editing the xml file or using Excel to unfreeze panes. Either way, the function starts to work.The file I worked on has been attached
LFS_data_with_element.xlsx
I used the github version of the package to try this. Session info is below:
The text was updated successfully, but these errors were encountered: