SetStyle method not working

Hi,


I am trying to format the Column in my excel where the Datetime will be displayed in Datetime format rather than General format (as string).
To test this, I chose one cell and set its style, but i dont see this working. The code is as below.

Aspose.Cells.Style st = _workSheet.Cells[“A5”].GetStyle();
st.Number = 14;
_workSheet.Cells[“A5”].SetStyle(st);

Hi,

Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells
for .NET v8.5.1.1
it is working fine with your code.

I have tested this issue with the following sample code. I have attached the source excel file used in this code and output excel file generated by it for your reference. I have also shown the screenshot which shows that cell A5 is now having Date format highlighted with red circle.

C#


string filePath = @“D:\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet _workSheet = workbook.Worksheets[0];


Aspose.Cells.Style st = _workSheet.Cells[“A5”].GetStyle();

st.Number = 14;

_workSheet.Cells[“A5”].SetStyle(st);


workbook.Save(filePath + “.out.xlsx”);