You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
writeXlsx and writeXlsxStream format a styled cell in a formatted column differently #616
writeXlsx uses the cell's own style as is, so the column's format is dropped. The stream writer's RowSerializer.serializeRow adds the column's numFmt to any style that has none, but not the column's font, fill or anything else.
Expected
Both writers resolve a cell's format the same way. Which way is right is a design choice:
Own style replaces the column's (what writeXlsx does): simple, but a bold cell in a currency column loses its currency format.
Own style layered over the column's: closer to Excel, where a cell in a formatted column keeps the column's format when you make it bold. The stream writer half-does this, for numFmt only.
A second difference between the two writers, also about column formats: writeXlsxStream never writes a column's style onto <col>. The cells it writes do get the style, so the rows you streamed look right. But a cell typed into the column later doesn't get the format, and the column comes back without its style when the file is read.
main at c991ad0. buildSheetPrelude in src/xlsx/stream-writer.ts writes width, hidden and outlineLevel on <col> but not style, and it writes no <col> at all for a column with only a style or a numFmt. The buffered writer has done both since #439 §W. CodeRabbit raised this while reviewing #614. That PR only touches the <col> width, so it leaves this alone.
Activity
ronistrom commentedon Oct 21, 2026
A second difference between the two writers, also about column formats:
writeXlsxStreamnever writes a column's style onto<col>. The cells it writes do get the style, so the rows you streamed look right. But a cell typed into the column later doesn't get the format, and the column comes back without its style when the file is read.<col>readStyles: truewriteXlsx<col min="1" max="1" width="12" customWidth="true" style="1"/>s="1"{ width: 12, style: { numFmt: "\"$\"#,##0.00" } }writeXlsxStream<col min="1" max="1" width="12" customWidth="true"/>s="1"{ width: 12 }main at c991ad0.
buildSheetPreludeinsrc/xlsx/stream-writer.tswriteswidth,hiddenandoutlineLevelon<col>but notstyle, and it writes no<col>at all for a column with only a style or anumFmt. The buffered writer has done both since #439 §W. CodeRabbit raised this while reviewing #614. That PR only touches the<col>width, so it leaves this alone.fix(xlsx): resolve a styled cell in a formatted column the same in bo…