Free Support Forum - aspose.com

Formatting cells to display Danish characters

Hi.
I have an excel sheet that I am creating with Danish characters. The Danish characters are being displayed as some weird characters. For example: “før” should be “før”.
I cannot find anything about setting the encoding on a workbook. I found something about setting csv encoding but that is not what I am using.
I am using the .NET Aspose.Cells library and creating my document like this:
using(Workbook workbook = new Workbook()){
Worksheet worksheet0 = workbook.Worksheets[0];
// Work with worksheet0
Worksheet worksheet1 = workbook.Worksheets.Add(“worksheet1”);
// Work with worksheet1
}

Thanks.

@Simmi

Thanks for using Aspose APIs.

For XLS and XLSX file, encoding is always Unicode so your Danish character should display fine. We tested this issue with the following code and it works fine. Please see the output Excel file and screenshot given below for a reference.

If your issue still occurs, then please provide us runnable sample code (preferably console application project) along with your Excel file(s) if there is any, that we could use to replicate the issue at our end. We will look into it and help you asap.

Please also download and use the latest version and see if it makes any difference and resolves your issue.

Download Link:
output.zip (5.6 KB)

C#

Workbook wb = new Workbook();

Worksheet ws = wb.Worksheets[0];
ws.Cells["A1"].PutValue("før");

wb.Save("output.xlsx");

Screenshot:

I figured it out while creating the runnable sample code.
I read the column headers from a file and that file had encoding issues. :confused:

The problem is solved.
Thanks for a quick reply.

@Simmi

It is good to know that you are able to figure out this issue and it is resolved now. Let us know if you encounter any other issue, we will be glad to look into it and help you further.