Posted 4 August 2025, 3:15 pm EST
Problem Summary
SpreadJS correctly displays accounting format ($ left-aligned, numbers right-aligned) in the live spreadsheet view, but
toHtml()
export loses this formatting and applies text-align: right
to the entire string, making the dollar sign appear right-aligned instead of left-aligned.
Expected Behavior
Accounting format should maintain left-aligned dollar sign and right-aligned numbers in HTML export, matching the live view appearance.
Actual Behavior
toHtml()
exports accounting cells as:
<td style="text-align: right;">$1,234.56</td>
This makes the entire content (including $) right-aligned, breaking the accounting format.
Expected: HTML that preserves $ left-aligned, number right-aligned
Question
Is there a way to make
toHtml()
preserve proper accounting format alignment, or is this a known limitation? Any workarounds or parameters that maintain the visual formatting seen in the live view?
Environment
- SpreadJS version: 18
- Browser: Chrome
- Use case: PDF generation from exported HTML