This document mirrors the visual and formatting rules used on the frontend for .xlsx exports.
It does not run automatically: backend code paths (JasperReports XLSX export, Apache POI, etc.) are separate from the Next.js xlsx-js-style pipeline. Apply these rules manually when implementing or changing server-side Excel so outputs stay consistent with the UI standard.
Frontend reference (implementation details):
FPSMS-frontend/src/app/(main)/chart/_components/EXCEL_EXPORT_STANDARD.md
Typical cases:
JRXlsxExporter or similar).XSSFWorkbook, SXSSFWorkbook) building sheets in Kotlin/Java services (e.g. production schedule export, BOM, item templates).Reports that return JSON only and let the browser build the file (e.g. GRN rep-014) are not covered here — those follow the frontend doc.
| Element | Target |
|---|---|
| Header row | Bold, black text; fill light grey #D9D9D9 (RGB); vertical center; for header text use horizontal center + wrap unless the column is numeric (see below). |
| Money / amount columns | Excel number format #,##0.00 (thousands separator, 2 decimals). Right-align header and data. |
| Quantity columns | Right-align header and data (no fixed decimal rule on frontend; match business need). |
| Column width | At least readable for bilingual headers; frontend uses max(12, headerLength + 4) character width — approximate in POI with setColumnWidth. |
Align with frontend header keywords so exports feel the same:
金額, 單價, Amount, Unit Price, Total Amount (including bilingual labels like Amount / 金額).Qty, 數量, Demand.CellStyle for header: setFillForegroundColor (indexed or XSSFColor for #D9D9D9), setFillPattern, bold font, alignment.DataFormat → "#,##0.00" on numeric cells.setAlignment(HorizontalAlignment.RIGHT) for amount/qty columns (and header cells in those columns if desired).#,##0.00 where supported.Aligned with frontend EXCEL_EXPORT_STANDARD.md (grey #D9D9D9, #,##0.00 for amounts, right-align numeric columns).