Skip to content

Commit

Permalink
fix(abc:st): correct width misalignment in export excel
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Sep 23, 2023
1 parent 7a21933 commit e52c449
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/abc/st/st-export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,17 @@ export class STExport {
const sheet: { [key: string]: NzSafeAny } = (sheets[opt.sheetname || 'Sheet1'] = {});
const dataLen = opt.data!.length;
let validColCount = 0;
let loseCount = 0;
const columns = opt.columens! as _STColumn[];
const columns = (opt.columens! as _STColumn[]).filter(
col => !(col.exported === false || !col.index || !(!col.buttons || col.buttons.length === 0))
);
if (columns.findIndex(w => w._width != null) !== -1) {
// wpx: width in screen pixels https://github.com/SheetJS/sheetjs#column-properties
sheet['!cols'] = columns.map(col => ({ wpx: col._width }));
}
for (let colIdx = 0; colIdx < columns.length; colIdx++) {
const col = columns[colIdx];
if (col.exported === false || !col.index || !(!col.buttons || col.buttons.length === 0)) {
++loseCount;
continue;
}
++validColCount;
const columnName = this.xlsxSrv.numberToSchema(colIdx + 1 - loseCount);
const columnName = this.xlsxSrv.numberToSchema(colIdx + 1);
sheet[`${columnName}1`] = {
t: 's',
v: typeof col.title === 'object' ? col.title.text : col.title
Expand Down

0 comments on commit e52c449

Please sign in to comment.