Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi

I have an application that generate xls sheet .But it is unable to render unocode character like Russian,Chinese correctly.
How to set encoding here ?
Is dere any other way to handle it .


Thanks
Posted

1 solution

A good tool for generating Excel sheet is the EPPlus library, which you can download from here; http://epplus.codeplex.com/[^]

An example;
C#
using System.IO;
// Reference EPPlus.dll
using OfficeOpenXml;

namespace AccessExcelUnicodeTest {
    class Program {
        public static void Main(string[] args) {
            var target = new FileInfo(@"C:\Temp\sheet.xlsx");
            var package = new ExcelPackage(target);
            var sheet = package.Workbook.Worksheets.Add("Content");

            sheet.Cells[1, 1].Value = "Unicode string \u0751\u0752\u0753";

            package.Save();
        }
    }
}


Run that and open C:\Temp\sheet.xlsx and you should see a string containing some Arabic letters.

Hope this helps,
Fredrik
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900