Hello,
Hi,
Thanks for your question and using Aspose.Cells for .NET.
I have tested the cell formatting using the following code with the latest version:
Aspose.Cells
for .NET v7.3.0.2
and everything is working fine.
As you can see in the code Style.Custom is working fine.
I have attached the output xlsx file and the screenshot for your reference. Let us know if you still have any question.
C#
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Cell cell = worksheet.Cells[“A1”];
cell.PutValue(3424);
Style st = cell.GetStyle();
st.Custom = “”$"#,##0_);[Red]\("$"#,##0\)";
cell.SetStyle(st);
workbook.Save(“output.xlsx”);
Screenshot:
Your demo works for me, after playing around with it I realize where my mistake was made. The object value must have been processed as a string, if you change your code to:
Hi,
Thanks for your feedback.
It’s good to know your issue is now resolved.
Also, if you want to use string, then you can use another overload i.e Cell.PutValue(string stringValue, bool isConverted)
See the following code.
C#
string data = “3426”;
cell.PutValue(data, true);
If you have any other question or face any other issue, please let us know, we will help you asap.