Repository navigation
Fix #2572: namespace prefixes and calc attributes in worksheet XML - #2575
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #2572
When a worksheet uses a namespace prefix for the main schema (e.g.
x:, as written by the Open XML SDK),WorksheetXmlWriterwrote some elements without the prefix. These ended up in no namespace, so Excel ignored them or reported the file as corrupt.Changes
UpdateRowCellData): usefTaginstead of a hard-coded<f>.cfvo(WriteCfIcon,GetCFXML): pass the prefix toWriteCfIcon.UpdateExtLstConditionalFormatting,GetXMLCFExt,WriteStyle): pass the main prefix through, so the children ofx14:dxfare written in the main namespace.SetCalcAttributesForArrayFormula): reset the attribute string for every cell, soaca/cano longer leak from an array formula to the following formula cells.Tests
New test class
Core/Worksheet/WorksheetXmlWriterTests.cswith four tests, one per case. The prefix tests use a workbook saved by the Open XML SDK and assert that no element in the worksheet XML is written without a namespace. All four tests failed before the fix.Output verified in Excel: shared formulas are kept, the icon set workbook opens without repair, and the extLst rule keeps its format.