Skip to content
This repository has been archived by the owner on Nov 17, 2024. It is now read-only.

Commit

Permalink
refactor: excel column auto width
Browse files Browse the repository at this point in the history
  • Loading branch information
sugrado committed Apr 16, 2024
1 parent 675890b commit 91b2054
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion v1/src/scripts/utils/excel.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const writeWorkbookToFile = async (workbook) => {
const createWorksheetHeaders = (worksheet, columns) => {
const sheetColumns = [];
Object.entries(columns).forEach(([key, value]) => {
sheetColumns.push({ header: value, key });
sheetColumns.push({
header: value,
key,
width: value.length < 12 ? 12 : value.length,
});
});
worksheet.columns = sheetColumns;
worksheet.getRow(1).font = { bold: true };
Expand Down

0 comments on commit 91b2054

Please sign in to comment.