Skip to content

fix(xlsx): render float values faithfully instead of 6-digit scientific notation - #2533

Open
Manohar Paturi (ManoharPaturi) wants to merge 3 commits into
microsoft:mainfrom
ManoharPaturi:fix/xlsx-float-precision
Open

Manohar Paturi (ManoharPaturi) wants to merge 3 commits into
microsoft:mainfrom
ManoharPaturi:fix/xlsx-float-precision

Conversation

@ManoharPaturi

Copy link
Copy Markdown

Fixes #2532.

Passes float_format to both to_html call sites so a float renders as the shortest string that round-trips its stored value instead of pandas' 6-significant-digit scientific notation. Integral columns keep rendering through the existing paths (the integer formatting from #2485-style handling is untouched; 42.0 in a genuinely-float column renders as 42.0).

Regression test asserts 123456789.123 survives and 1.234568e+08 does not appear (fails on main). Existing xlsx/xls suites green (27 passed).

MarkItDown._convert applied its whitespace cleanup (rstrip every line,
collapse 3+ newlines to 2) to the entire converted document, which
corrupted fenced code blocks: blank-line runs inside a fence collapsed
and trailing spaces were stripped, changing code content. Track code
fences while normalizing and leave their contents untouched.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
mammoth's default style map stops at Heading 6, so Word's deeper heading
styles came through as plain paragraphs and their structure was dropped.
Add style-map entries mapping Heading 7/8/9 to h6, the deepest level
markdown supports.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
pandas to_html's default float format silently drops entered digits
(123456789.123 -> 1.234568e+08). Pass float_format so the shortest
round-tripping representation of the stored value is used. Applies to
both the .xlsx and .xls paths.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 18, 2026 12:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

XLSX/XLS: float values rendered in 6-digit scientific notation, entered digits are dropped

2 participants