Changing the format of the cell from General to Custom while retrieving the values

Hi,

I have an sheet with row with values 00:00 ,01:00 upto 23:00 in a row in General format.

I want to change the format of that row to Custom format hh:mm before reading the values from that row.

Please suggest me how I can change the format of a cell or row.

Thanks,

M.Geetha.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please use the Style object to change the format of the cell. Please see the following code for your reference.

C#


Worksheet worksheet = workbook.Worksheets[0];


Cell cell = worksheet.Cells[“A1”];


Style style = cell.GetStyle();

style.Custom = “hh:mm”;

cell.SetStyle(style);

Thank you for your suggestion,But I have applied the same code already,But while retrieving the values the DateTimevalue ,Double value ,Float value properties of that cell is not coming it is appearing as Exception of Type :'{System.Exception}' occured is there.

If I change the format of the cell manually those same properties is having the value as 0.0 for 00:00 in DateTimevalue ,Double value ,Float value and value property will be having the Date value as #12/31/1899# {Date}

Why the same is not happening when we change the style dynamically in code?

Please suggest me.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please provide us your sample project replicating your issue with the latest version. We will look into your project and help you asap.