-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Bug Description
When applying text highlighting with custom colors (e.g. #FFEB3B) via the VS Code extension's formatText command, the DOCX export produces invalid OOXML that is silently ignored by Microsoft Word.
Current Behavior
SuperDoc exports highlighting as:
<w:highlight w:color="auto" w:val="clear" w:fill="FFEB3B" />This is invalid OOXML. The <w:highlight> element (§17.3.2.17 of OOXML spec) only accepts predefined color names (yellow, green, cyan, magenta, etc.) via w:val. It does not support w:fill or w:color attributes.
Result: Microsoft Word silently ignores the element and no highlighting is displayed.
Expected Behavior
For custom (non-predefined) highlight colors, SuperDoc should export using <w:shd> (shading) instead:
<w:shd w:val="clear" w:color="auto" w:fill="FFEB3B" />This is the standard OOXML approach for custom background colors on text runs and is correctly rendered by Microsoft Word.
For predefined colors, <w:highlight w:val="yellow" /> (etc.) would also be acceptable.
Steps to Reproduce
- Open a
.docxfile in the SuperDoc VS Code extension - Apply highlighting via the programmatic API:
(Or apply highlighting manually in the webview editor)
{"command":"formatText","args":{"highlight":"#FFEB3B","scope":{"from":103,"to":124}}} - Wait for auto-save
- Open the saved
.docxin Microsoft Word - Observe: no highlighting is visible
Workaround
Post-process the exported DOCX by replacing <w:highlight w:fill="..."> elements with <w:shd w:val="clear" w:color="auto" w:fill="..."> in word/document.xml.
Environment
- SuperDoc VS Code Extension v0.1.0 (Lawvable fork)
- macOS 15
- VS Code (latest)
- Microsoft Word for Mac