In Java I am using FastExcel to create a spreadsheet. I use the overloaded method value in the org.dhatim.fastexcel.Worksheet to set a cell's value: worksheet.value(row, column, value) In case the value is of type date the invoked method is:
public void value(int r, int c, Date value)
Inspecting the value in the spreadsheet it is displayed as a numerical value. The type of the cell is Standard. Changing the celltype to Date displayed the correct value. How can I configure FastExcel to set the cell's type as Date?
In FastExcel, users have the option to set the cell type as a Date using the setDate method instead of the value method. This allows for accurately assigning Date values to specific cells. Example
In the provided code snippet, a SimpleDateFormat is utilized to format the date. Following that, a Date object is created with the desired date value. Subsequently, the setDate method assigns this value to the cell as a Date type. Additionally, we utilize the drop-in parameter feature by passing in the aforementioned SimpleDateFormat to enable customization of date formatting.