Hi,
I'm running Aspose.Cells v 7.0.1.5 and have a problem relating to Style / Custom Number Format
The desired custom number format, as it works in Excel is:
_-* # ##0,00 kr_-;[Red]-* # ##0,00 kr_-;_-* "-"?? kr_-;_-@_-
... i.e. when I, in the Excel application use that format string, I get the number format I want.
When I set the Style.Custom property to that *exact* string, save the workbook and open the file in Excel, I notice that the custom number format has changed to:
_-* #\ ##0,00\ k\r_-;[Red]-* #\ ##0,00\ k\r_-;_-* "-"??\ k\r_-;_-@_-
... i.e. it seems as if spaces and the letter r are escaped, and the format is of course not what I want.
Please advice
Hi,
Please provide us the sample xls/xlsx file with your desired custom format number, you can create one manually using Ms-Excel.
We will look into it and fix your sample code.
See enclosed sample (cells A1 and A2 on Sheet1)
Hi,
Please see the following code.
I have attached the output file and the screenshot.
C#
Workbook workbook =
new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Set the style of A1
Cell cell = worksheet.Cells[“A1”];
Style st = cell.GetStyle();
st.Custom = “
-* #,##0.00\ “kr”-;[Red]\-* #,#
#0.00\ “kr”
-;-* “-”??\ “kr”
-;-
@_-”;
cell.SetStyle(st);
worksheet.Cells[“A2”].SetStyle(st);
//set the style of A2
//Put values
worksheet.Cells[“A1”].PutValue(222);
worksheet.Cells[“A2”].PutValue(-222);
workbook.Save(@“F:\Shak-Data-RW\Downloads\output.xlsx”);