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

Free Support Forum - aspose.com

Setting Danish Krone custom currency formatting in Excel using C#.NET


I need to set a cell to currency. I’d like to it be Danish Krone, I found the correct format, but I’m unsure how to apply this in the code:

Danish Krone







I would like to format two separate columns in my worksheet.

Any suggestions as to how I can achieve this please?

Hi Andy,

Thank you for contacting Aspose support.

You can use the Style.Custom property to specify the desired format and set the style object to as many columns as you like. For instance, please check the following piece of code that applies the currency format to 2 columns (B & C).

Please note, as you have not specified the platform of interest so I have posted the C# code. Let me know if you need Java code instead.


Workbook book = new Workbook(fileName);
Style style = book.CreateStyle();
style.Custom = “[$kr.-406] #,##0.00”;
Worksheet sheet = book.Worksheets[0];
sheet.Cells.Columns[1].ApplyStyle(style, new StyleFlag(){NumberFormat = true});
sheet.Cells.Columns[2].ApplyStyle(style, new StyleFlag(){NumberFormat = true});


Thanks for providing us some details.

Here is another way to accomplish the task, see the sample code on how to format a column with DKK currency for your requirements:
Sample code:

Workbook wb = new Workbook();

//Input some number into a cell.

int colIndex = 0;
Style style;
StyleFlag flag;
style = wb.CreateStyle();
style.Custom = “[$DKK] #,##0.00”; //Apply DKK currency formatting
flag = new StyleFlag();
flag.NumberFormat = true;
//Apply the formatting to the first column cells.
wb.Worksheets[0].Cells.ApplyColumnStyle(colIndex, style, flag);


Also, please see the document on how to apply (custom) numbers formatting for your complete reference:

Hope, this helps a bit.

Thank you.

Thanks, that’s great, do you have the same example for Euros please?


Sure, you may just change the line of code (from my previous code segment)
style.Custom = “[$DKK] #,##0.00”; //Apply DKK currency formatting

style.Custom = “[$€-2] #,##0.00”; //Apply Euro currency formatting

Thank you.