We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Detect Type Of Cell Before Send Data Into It

I want to check the type of cell using a range:


But I know there is no data in the cell to begin with, so it always returns CellValueType.IsNull

I need to check the type of formatting on the cell, so I then know how to put my data into the cell, such as using:


Do I have to know ahead of time that myValue should be a date?

Can I just check the formatting on the cell even though there is no data in it yet, so I send in the right data type?


Well, I think, while inserting the value, you may utilize the following overloaded version of the PutValue method of the Cell class, the method would automatically converts to its corresponding type based on the data you are inserting:


Cell.PutValue(string value, isConverted) of method //Always put true in the second parameter.

And you may use some other alternatives / attributes:


Cells.Style.Number, Cells.Style.Custom and Cells.Style.IsDateTime to get info about the Cell type if it does not have values.

Thank you.