Free Support Forum - aspose.com

Exporting Non english characters

Hello there

My datatable has lots of german characters stored. For example after export, 'ä' is shown in excel as ä

How to set this right? any help is appreciated. thanks.

Kit

Hi,

I could not find the issue using the attached version v4.9.0.5, could you try it.

Here is my sample code, the generated file has ‘ä’ characters fine in MS Excel. For reference, please see the output file here.

DataTable dt = new DataTable(“Customers”);
dt.Columns.Add(“C_FName”);
dt.Columns.Add(“C_LName”);
dt.Columns.Add(“Num”, typeof(decimal));
DataRow dr = dt.NewRow();
dr[“C_FName”] = “Richard”;
dr[“C_LName”] = “Milton”;
dr[“Num”] = -45;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[“C_FName”] = “Micheal”;
dr[“C_LName”] = “Dowdan”;
dr[“Num”] = 41;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[“C_FName”] = “ä”;
dr[“C_LName”] = “DEF”;
dr[“Num”] = -139;
dt.Rows.Add(dr);



Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];

//Populate the data starting from A1 Cell.
worksheet.Cells.ImportDataTable(dt, false, 0, 0, false);


workbook.Save(“e:\test\outputGermanChars.xls”);

If you still find the issue, kindly post your sample code with output file here.


Thank you.

Oh yes. You are right. The problem occurs when I read the data from the grid and store it in datatable. I mean to say, theose special characters are there in my dataTable :frowning: I will check it out. thanks.