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
Unable to format a columns header definition to be in date format. I can format it to a string that looks like a date, for example yyyy/mm/dd however, the cell type is a string and not a date so I cannot use the exported excel sheet as needed. My use case is creating pivot tables amongst other things based on the date that column is for.
Lib version: latest
Steps To Reproduce
const datedColumns = ['2024/02/02']
Create a workbook
Assign a column [{ header: '2024/02/02', key: '2024/02/02', width: 32 }] with worksheet.columns = columns;
dateColumns.forEach((column) => {
// try 1
worksheet.getRow(1).getCell(column).style = { numFmt: 'yyyy/mm/dd' };
// try 2
worksheet.getRow(1).numFmt = 'yyyy/mm/dd';
// try 3, this formats the data in the rows below the column header to be dates
worksheet.getColumn(column).numFmt = 'yyyy/mm/dd';
});
I've also tried defining the format on the column definition like so:
馃悰 Bug Report
Unable to format a columns header definition to be in date format. I can format it to a string that looks like a date, for example
yyyy/mm/dd
however, the cell type is a string and not a date so I cannot use the exported excel sheet as needed. My use case is creating pivot tables amongst other things based on the date that column is for.Lib version: latest
Steps To Reproduce
const datedColumns = ['2024/02/02']
[{ header: '2024/02/02', key: '2024/02/02', width: 32 }]
withworksheet.columns = columns;
[{ '2024/02/02': "Dummy Test" }]
I've also tried defining the format on the column definition like so:
``[{ header: '2024/02/02', key: '2024/02/02', width: 32, style: { numFmt: 'yyyy/dd/mm' } }]`
The expected behaviour:
I expect the resulting cell in my export to be formatted as a date cell, this would make the data in the cell right aligned too.
Possible solution (optional, but very helpful):
enable column header formatting
The text was updated successfully, but these errors were encountered: