Free Support Forum -

Cell.PutValue and Cell.Type

Dear Sir, Madam,

When a cell is empty (cell.Type == IsNull), and I call cell.PutValue(DateTime.Now) I would expect the cell.Type to become IsDateTime, instead the cell.Type becomes numeric. And cell.Value.GetType() returns System.Double. So my DateTime gets actively converted by Aspose.Cells to Double and I don't understand why.

How can I make Aspose.Cells set the cell.Type to IsDateTime?

Immediate window dump:

Expression has been evaluated and has no value



Kind regards,

Jorre Meijrink

This message was posted using Aspose.Live 2 Forum


Thank you for considering Aspose.

Please set the display format of cell before or after putting the value in a cell. Following is my sample code regarding your requirement.

Workbook book = new Workbook();


book.Worksheets[0].Cells["A1"].Style.Number = 15;


Please check the following documentation link for further details regarding setting display format of cells.

Thank You & Best Regards,

Thank you.

Style.Number = 14 does the trick for me.