Skip to content

Conversation

@nikbucher
Copy link
Contributor

Summary

Fixes #472: Quotation marks in custom date/number formats (e.g., yyyy-MM-dd"T"HH:mm:ss) caused XML parsing errors and corrupted Excel files.

Proposed Solution

Apply XmlEscapeHelper.escape() to format codes before writing them to XML. This helper already exists in the codebase and handles all necessary XML escapes ("&quot;, <&lt;, etc.).

Changes

File Change
StyleCache.java:167 Wrap e.getKey() with XmlEscapeHelper.escape()
CorrectnessTest.java Add test testFormatCodeWithSpecialCharacters()

Test plan

  • New test covers format codes with ", <, >, &, '
  • All 83 existing tests pass
  • Generated Excel files open without repair dialog

Fixes dhatim#472

Format codes containing quotation marks (e.g., ISO 8601 date format
yyyy-MM-dd"T"HH:mm:ss) were written unescaped to the formatCode XML
attribute, producing invalid XML that caused Excel repair dialogs.

Apply XmlEscapeHelper.escape() to format codes in StyleCache.write().
Copy link
Collaborator

@rzymek rzymek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@rzymek rzymek merged commit 763cd23 into dhatim:master Jan 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Quotation Marks in Custom Formats

2 participants