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

Free Support Forum - aspose.com

Not able to parse the cell if the cell format type is date-time etc

We are using the light cell api to parse the excel file.

If the Excel file contains cells which is in text,int,double then we are able to read correctly but if the user set the cell format as date,time or any other format then the value is comming as long .

eg:12/7/2008 (date) , 8:00 AM (time)

8:00AM
Here is the part of code which we are using:
public void process(LightCell cell)
{

switch(cell.getValueType())

{

case CellValueType.DOUBLE:
case CellValueType.STRING:
....
.....
}

Please let us know how can we handle date and time format date if the user has set the cell format type as date/time.

Is there any api on the light cell ,which we can use to read the cell data as string irrespective of the cell format defined on the cell in the Excel file.

Thanks

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

For the data type and value of LightCell, please refer to the javadoc of LightCell.getValue(),

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/com/aspose/cells/lightcell.html

If the cell's format is defined as date/time, the data type returned by LightCell.getValueType() will be CellValueType.DATETIME, and the value will be Long, which is time in UTC milliseconds, you can easily build a Date, Calendar from it. For formatting value as String according to cell's format setting, currently LightCells does not support it, we will look into it and consider to support it in our later versions.

Thank You & Best Regards,

In this case we need to format the date in dd/mm/yyyy or mm/dd/yyyy in the code but issue is that as per our requirement we cannot hard cord the date format .the Date format should be same as user has entered or formated on the cell.

Please advice us.