iOfficeAI / iOfficeAI/OfficeCLI
[BUG] DOCX HTML preview does not render whitespace-only underlined runs
- Dominant language
- C#
- Stars
- 30.7k
- Forks
- 2.1k
- Avg merge
- 9d 8h
- Merged PRs (30d)
- 5
Description
## Description
In DOCX HTML preview, a run whose visible content consists only of preserved spaces and whose OOXML run properties specify a single underline does not render as a visible fill-in line in Chromium-based browsers.
This pattern is common in forms and bid documents, where empty fields are authored as underlined spaces. Word and WPS Office render the underline continuously, but `officecli view .docx html` leaves the field visually blank.
## Environment
- OfficeCLI: 1.0.143
- Output mode: `view ... html`
- Browser: Chromium-based browser
- Confirmed against the same DOCX in WPS Office
## Minimal document structure
The affected run has valid OOXML equivalent to:
```xml
```
The same behavior can be reproduced by creating a DOCX in Word/WPS, typing several spaces between two labels, selecting those spaces, applying underline, and saving the document.
## Steps to reproduce
1. Create a DOCX containing a whitespace-only underlined run as above.
2. Run:
```sh
officecli view sample.docx html > preview.html
```
3. Open `preview.html` in a Chromium-based browser.
4. Compare it with the original DOCX in Word or WPS Office.
## Actual behavior
The generated HTML represents the run approximately as:
```html
```
The browser does not paint a continuous underline for this whitespace-only inline content, so the empty form field disappears visually.
Runs containing non-whitespace text still show the underline beneath the text, which makes this especially noticeable for blank fields.
## Expected behavior
The HTML preview should preserve a visible line with approximately the same advance width as the whitespace-only run in the DOCX.
A renderer-level representation such as a measured inline block with a bottom border may be needed for whitespace-only underlined runs, while retaining the original run width and character spacing.
## Notes
- The source DOCX is correct and renders as expected in Word/WPS.
- This was reproduced on the latest published version, 1.0.143.
- Searches of open and closed issues for DOCX underline, blank underline, whitespace underline, NBSP underline, and equivalent Chinese terms did not find an existing report.
Contributor guide
Research direction
Start by tracing the HTML output produced by `officecli view .docx html`, focusing on how OOXML runs with `w:u` and whitespace-only `w:t` content become spans. Reproduce the sample in Chromium and compare it with Word or WPS; done means the preview shows a continuous underline with approximately the source run's width while text underlines remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, html
- Domain
- cli, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100