I am exporting empty excel sheet with some header values. In that excel sheet I want to set the date format like (mm/dd/yyyy) for date field. How to set the specified format for that cell.
Here I defined excel sheet cells:
var InstructionSheet = workbook.addWorksheet('Instruction');
InstructionSheet.getCell('A22').value = 'F: Start Date';
InstructionSheet.getCell('A22').font = {
name: 'Calibri',
bold: true
};
worksheet.columns = [
{ header: 'ProjectName', key: 'id', width: 10 },
{ header: 'UniqueID', key: 'name', width: 40 },
{ header: 'Name', key: 'name', width: 40 },
{ header: 'ResourceNames', key: 'name', width: 32 },
{ header: 'Type', key: 'name', width: 32 },
{ header: 'IsBillable', key: 'name', width: 12 },
{ header: 'IsCR', key: 'name', width: 12 },
{ header: 'Duration', key: 'name', width: 25 },
{ header: 'StartDate', key: 'string', width: 25 },
{ header: 'EndDate', key: 'string', width: 25 },
{ header: 'Predecessors', key: 'string', width: 25 },
{ header: 'Phase', key: 'string', width: 25 },
];
worksheet.getCell('I1').font = { // Start Date column
name: 'Calibri',
bold: true
};
I tried to set the date format in this way. But it is not working
InstructionSheet.getCell('A22').font = { name: 'Calibri', bold: true, dateformate:'mm-dd-yyyy' }; InstructionSheet.getCell('A22','mm-dd-yyyy').value = 'F: Start Date';
How do I set the specified date format for the date column while generating the excel sheet.
Thanks in advance