We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ejGrid export to pdf,but chinese character is empty character.

GridProperties obj = ConvertGridObject(gridModel);
            PdfExport exp = new PdfExport();
            IList<Notice> noticeList = new List<Notice>();
            noticeList.Add(new Notice()
            {
                NoticeTitle = "阿斯蒂芬",
                NoticeType = "teast"
            });
            noticeList.Add(new Notice()
            {
                NoticeTitle = "test2",
                NoticeType = "asdf"
            });
            IEnumerable<Notice> result = noticeList;
            
            exp.Export(obj, result, "Export.pdf"falsefalsetrue"flat-saffron");

Thank you!

1 Reply

MS Mani Sankar Durai Syncfusion Team September 15, 2016 12:16 PM UTC

Hi tmzl, 

 We are sorry for the late response. 

We have analyzed your query and achieved your requirement by using ServerPdfQueryCellInfo of Exporting server events. We have changed the font name as “Arial Unicode MS” to show the Chinese character while exporting into PDF. 
 
Please refer the below code example, 
[HomeController.cs] 
public void ExportToPdf(string GridModel) 
        { 
            PdfExport exp = new PdfExport(); 
            List<Person> Persons = new List<Person>(); 
            Persons.Add(new Person() { FirstName = "????", LastName = "Beckett" }); 
            Persons.Add(new Person() { FirstName = "Ben", LastName = "Beckett" }); 
            Persons.Add(new Person() { FirstName = "????", LastName = "????" }); 
            GridProperties obj = ConvertGridObject(GridModel); 
            var DataSource = Persons; 
            obj.ServerPdfQueryCellInfo = QueryCellInfo; 
            exp.Export(obj, DataSource, "Export.pdf", false, false,true, "flat-saffron"); 
        } 
        public void QueryCellInfo(object currentCell) 
        { 
            Syncfusion.Pdf.Grid.PdfGridCell range = (Syncfusion.Pdf.Grid.PdfGridCell)currentCell; 
            range.Style.Font = new PdfTrueTypeFont(new System.Drawing.Font("Arial Unicode MS", 12f), true); 
        } 
 
Before exporting into PDF the QueryCellInfo will get triggered to change and access the particular cell information. 
 
We have also prepared a sample that can be downloaded from the below link, 
 
Also please refer the documentation of how we can Export Server events 
Please let us know if you need further assistance. 
 
Regards, 
Manisankar Durai. 
 
 


Loader.
Up arrow icon