-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Add x: namespace prefix to sheetData elements for Excel compatib… #1
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1460,12 +1460,12 @@ private void LoadMergeCells(XmlReader xr) | |||||||||
| /// <param name="sw">The writer</param> | ||||||||||
| private void UpdateMergedCells(StreamWriter sw) | ||||||||||
| { | ||||||||||
| sw.Write("<mergeCells>"); | ||||||||||
| sw.Write("<x:mergeCells>"); | ||||||||||
| foreach (string address in _mergedCells) | ||||||||||
| { | ||||||||||
| sw.Write("<mergeCell ref=\"{0}\" />", address); | ||||||||||
| sw.Write("<x:mergeCell ref=\"{0}\" />", address); | ||||||||||
| } | ||||||||||
| sw.Write("</mergeCells>"); | ||||||||||
| sw.Write("</x:mergeCells>"); | ||||||||||
| } | ||||||||||
| /// <summary> | ||||||||||
| /// Reads a row from the XML reader | ||||||||||
|
|
@@ -3442,7 +3442,7 @@ private void SaveXml(Stream stream) | |||||||||
| else | ||||||||||
| { | ||||||||||
| CreateNode("d:cols"); | ||||||||||
|
||||||||||
| CreateNode("d:cols"); | |
| CreateNode("d:cols"); | |
| // The sheetData node is generated dynamically below, so we do not create it here. | |
| // WARNING: Ensure that dynamically generated sheetData content uses consistent XML namespaces. |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'x:' namespace prefix is incorrect for colBreaks and brk elements. These are main spreadsheet schema elements that should either be unprefixed (default namespace) or match the prefix used in the original worksheet XML. The 'x:' prefix is reserved for VML drawing elements (schemaMicrosoftExcel), not for these elements. This will cause XML validation errors and break compatibility with standard Excel files.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant call to 'ToString' on a String object.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'x:' namespace prefix is incorrect for rowBreaks and brk elements. These are main spreadsheet schema elements that should either be unprefixed (default namespace) or match the prefix used in the original worksheet XML. The 'x:' prefix is reserved for VML drawing elements (schemaMicrosoftExcel), not for these elements. This will cause XML validation errors and break compatibility with standard Excel files.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant call to 'ToString' on a String object.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opening <f> tag is missing the x: namespace prefix while the closing tag has it (</x:f>). This creates an XML mismatch. Change <f ref= to <x:f ref= for consistency.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opening <f> tag is missing the x: namespace prefix while the closing tag has it (</x:f>). This creates an XML mismatch. Change <f ref= to <x:f ref= for consistency.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opening <f> tag is missing the x: namespace prefix. Change <f t= to <x:f t= for consistency with other formula elements.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opening <f> tag is missing the x: namespace prefix while the closing tag has it (</x:f>). This creates an XML mismatch. Change <f ref= to <x:f ref= for consistency.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'x:' namespace prefix is incorrect for the 'v' (value) element. This is a main spreadsheet schema element that should be unprefixed or match the worksheet's namespace prefix. Using 'x:' (which is for VML elements) will cause XML validation errors.
| return "<x:v>" + ConvertUtil.ExcelEscapeString(GetValueForXml(v)) + "</x:v>"; //Fixes issue 15071 | |
| return "<v>" + ConvertUtil.ExcelEscapeString(GetValueForXml(v)) + "</v>"; //Fixes issue 15071 |
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'x:' namespace prefix is incorrect for 'row' elements. Row elements are part of the main spreadsheet schema and should either be unprefixed (default namespace) or match the prefix used in the original worksheet XML. The 'x:' prefix is reserved for VML drawing elements. This will break standard Excel files.
Copilot
AI
Dec 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'x:' namespace prefix is incorrect for 'row' elements in the StreamWriter version. Row elements are part of the main spreadsheet schema and should either be unprefixed (default namespace) or match the prefix used in the original worksheet XML. The 'x:' prefix is reserved for VML drawing elements. This will break standard Excel files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'x:' namespace prefix is incorrect for main spreadsheet elements. The 'x:' prefix is registered for
schemaMicrosoftExcel(urn:schemas-microsoft-com:office:excel) which is used for VML drawings, not for main spreadsheet elements like mergeCells, mergeCell, etc.Main spreadsheet elements should either be:
Hardcoding 'x:' prefix will break standard Excel files where these elements are unprefixed. Consider dynamically detecting and using the appropriate prefix from the worksheet root element instead of hardcoding 'x:'.