When I'm exporting a file that has dates, the format is coming across as general instead date. When I inspect the column data deserialized from the model object it is indeed showing a date format, it just doesn't seem to be applied when the workbook is created. Any suggestions?
1 Answer, 1 is accepted
0
Nikolay Demirev
Telerik team
answered on 18 Feb 2019, 11:08 AM
Hello B Smith,
The RadSpreadStreamProcessing exports only the data which is given. It does not "understand" that it is a Date value in order to apply a number format. In order to export cell values formatted as Date, you have to set the cell format too. Here is an example:
using (FileStream stream = File.Open(fileName, FileMode.OpenOrCreate))
{
using (IWorkbookExporter workbook = SpreadExporter.CreateWorkbookExporter(documentFormat, stream))
{
using (IWorksheetExporter worksheet = workbook.CreateWorksheetExporter("Date"))
{
using (IRowExporter row = worksheet.CreateRowExporter())
{
using (ICellExporter cell = row.CreateCellExporter())
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.