EPPlusSoftware / EPPlus

EPPlus-Excel spreadsheets for .NET
https://epplussoftware.com
Other
1.8k stars 274 forks source link

Worksheet Freeze Adding Unsupported Attributes to XML (topLeftCell) #637

Closed fishberg5051 closed 2 years ago

fishberg5051 commented 2 years ago

Hello,

We've recently upgraded our nuget package from 5.3.1 to 6.0.3 (yes lots of changes since then). When using 5.3.1, we would add a freeze reference for a worksheet by doing the following:

sheet.View.FreezePanes(2, 1);

Our workbooks and worksheets open fine in excel, but we do have some users parsing the open xml documents for various reasons. The reported an issue to us saying their library couldn't support the attribute of "topLeftCell" within the "selection" element underneath the sheetView element.

Adding some debug to our code where we build an excel report for them, I took a before and after of the innerXML for a sheet and notice that the freeze does inject additional attributes, which makes sense for the pane element, but adding the "topLeftCell" attribute doesn't make sense to me yet.

It seems maybe something related to: https://github.com/EPPlusSoftware/EPPlus/blob/develop/src/EPPlus/ExcelWorksheetView.cs within the function of CreateSelectionXml

but this is only a guess...

Are we doing something incorrectly before or after calling the FreezePanes function?
I'm happy to provide more details or inputs, but just curious if this is a known issue or not.

Cheers.

[XML BEFORE Freeze] - <?xml version="1.0" encoding="utf-8"?><worksheet xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetViews><sheetView workbookViewId="0" /></sheetViews><sheetFormatPr defaultRowHeight="15" /><sheetData /></worksheet>"

**[17:53:21 INF] [XML AFTER Freeze] - <?xml version="1.0" encoding="utf-8"?><worksheet xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetViews><sheetView workbookViewId="0"><pane ySplit="1" topLeftCell="A2" state="frozen" activePane="bottomLeft" /><selection pane="bottomLeft" activeCell="A1" sqref="A1" _topLeftCell="A2"_ /></sheetView></sheetViews><sheetFormatPr defaultRowHeight="15" /><sheetData /></worksheet>**

JanKallman commented 2 years ago

Yes, this attribute is in incorrect on the selection element. I'll try to provide a fix shortly.

fishberg5051 commented 2 years ago

@JanKallman - Thanks for the feed back / confirmation. When might this be fixed / released? I don't know what the typical release time for these types of things are.

Thank you for your time.

JanKallman commented 2 years ago

We will likely release a new version next week, so I hope it can be included there. I'll get back to you when the fix is done.

JanKallman commented 2 years ago

Fixed in version 5.8.10 and 6.0.4

fishberg5051 commented 2 years ago

Fixed in version 5.8.10 and 6.0.4

verified it's working now. Much appreciated!