About DevExpress GridControl Export PDF Chinese garbled headline, and transverse export settings

GridControl export to PDF, is often asked Chinese font garbage problem (as shown below), this is because gridcontrol the default font does not support PDF font library, so the Chinese fonts will become garbled.

 

After exporting PDF

The solution is to change the font attributes GridControl print PDF can support Chinese fonts, such as to "Times New Roman" or "black body" and so on, modify the fonts can be exported, and on the following operations, modify AppearancePrint corresponding font style , for example, I modified the row and column headings for the Times New Roman font.

View results:

 

For related export controls, one is to modify the relevant attributes of the property gridView.OptionsPrint, and calls ExportToPDF method of the second parameter PdfExportOptions type parameter, there is treated with PrintInitialize events, such as how to export the title refers to the transverse PDF, you need to use this event handling, event handling a lot of things, there is a need to look at themselves.

Event handling code:

private void gridView1_PrintInitialize(object sender, DevExpress.XtraGrid.Views.Base.PrintInitializeEventArgs e)
        {
            e.Link.PrintingSystemBase.PageSettings.Landscape = true;//两个方法都可以
            //(e.PrintingSystem as DevExpress.XtraPrinting.PrintingSystemBase).PageSettings.Landscape = true;
        }

Renderings:

Guess you like

Origin blog.csdn.net/u012097590/article/details/94604568