Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
690
UltraGrid not displaying Chinese/Japanese Characters when Exported to Report Doc
posted

Hello,

in a dummy project, we have the following UltraGrid(Infragistics version 17.2):

The 1st column header contains Chinese characters, the 2nd col header contains Japanese characters and the last contains Russian. The rows also contain the same characters in the first column. 

When we try to export this UltraGrid to a .pdf report document, we get this result:

As you can see, the Chinese and Japanese characters fail to be displayed correctly.

Attached you may find a dummy project, which you may use to reproduce this issue.

2110.ReportTranslation.zip

  • 469350
    Offline posted

    Hi, 

    The really mysterious part here isn't why doesn't the text show up in the PDF, but why DOES it show up in Windows. The sample application you have here is using the default font (MS Sans Serif) which is an English font and doesn't actually contain any of those Chinese or Japanese characters. I'm not actually sure why that works on the screen, but presumably Windows or DotNet does some magic there to make it work for you. 

    To make this work in the PDF, those characters have to be displayed in a Japanese or Chinese font. 

    For Japanese, the most common font to use is Meiryo. So you would have to do a couple of things: 

    1) Make sure Meiryo is installed on your machine.

    2) Tell the grid to use Meiryo for those cells that are using Japanese characters. 

    I updated your sample to assign Meiryo to the header of the second column and tried it out on my machine and (after I installed Meiryo on my machine), it exported correctly. 

            private void UltraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
            {
                var layout = e.Layout;
                var band = layout.Bands[0];
    
                var japaneseColumn = band.Columns["幅"];
                japaneseColumn.Header.Appearance.FontData.Name = "Meiryo";
            }

    You will need to to the same for the CellApperarance, too, if any of the cells contain Japanese characters. And, of course, you will need to use a Chinese font for the first column header and the cells of that column.