Open guhyeon opened 3 years ago
@guhyeon I use below function for autowidth.
function setAutoWidth(workbook) {
workbook.sheets().map(sheet => {
const rows = sheet.usedRange().value(),
widths = rows.reduce(
(memo, row) => row.map((cell, index) => Math.max(cell?.length ?? 0, memo[index])),
Array(rows[0].length).fill(0)
);
widths.map((width, index) => sheet.column(index + 1).width(width + 2)); // 2 extra points
});
}
Hello, you might be interested in @papb/json-excel, that has this feature.
Hello, thank you for your efforts. There was an issue resizing column widths for content. Excel has a feature called AutoFit. Does xlsx-populate have that feature? If not, do you have any plans for it?