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

Free Support Forum - aspose.com

Corrupted Custom Number Format


I'm running Aspose.Cells v 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


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)


Please see the following code.

I have attached the output file and the screenshot.


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”-;-@_-”;


worksheet.Cells[“A2”].SetStyle(st); //set the style of A2

//Put values




That worked, thank you!