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

Turkish Characters Problem

I use grid with export. https://ej2.syncfusion.com/angular/demos/#/material/grid/default-exporting

I cannot export because of Turkish characters.

What should I do?

3 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team September 6, 2019 11:03 AM UTC

Hi Kenan, 

Greetings from the Syncfusion support, 

We could see you would like to use the Turkish font style for the Exporting Grid. This can be achieved by assigning the base64 string for Turkish font style to PdfTrueTypeFont property which can be assigned later to the Exporting theme of the Pdf export Properties. Refer to the following steps. 

We request you to use the corresponding custom font base64 string in your application.  
 
  1. Download TTF file for the corresponding (custom) font (https://www.fontsquirrel.com/fonts/list/language/turkish )
  2. Then convert the TTF file into base64 string (https://www.giftofspeed.com/base64-encoder/).
  3. Finally apply the base64 string to pdfTrupetypeFont.

import { data, base64_Turkishfont } from './datasource'; 
 
@Component({ 
  selector: 'app-root', 
  template: `<ejs-grid [dataSource]='data' [allowGrouping]='true' [allowPaging]='true' 
  [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)'  
        [allowExcelExport]='true' [pageSettings]='pageSettings' [allowPdfExport]='true'> 
                <e-columns> 
                    <e-column field='OrderID' headerText='รหัสคำสั่งซื้อ' textAlign='Right' width=90></e-column> 
                </e-columns> 
                </ejs-grid>`, 
  providers: [ToolbarService, PageService, ExcelExportService, PdfExportService] 
}) 
export class AppComponent implements OnInit { 
 
  public gridData: Object[]; 
  public toolbar: string[]; 
  public pageSettings: Object; 
  @ViewChild('grid') 
  public grid: GridComponent; 
  . . . . . 
toolbarClick(args: ClickEventArgs): void { 
  let id: any = document.getElementsByClassName('e-grid')[0].id + '_pdfexport'; 
  let grid: any =  (document.getElementsByClassName('e-grid')[0] as any).ej2_instances[0]; 
    if (args.item.id === id) { 
        let pdfExportProperties: PdfExportProperties = { 
            theme: { 
                header: {font:  new PdfTrueTypeFont(base64_Turkishfont, 12) }, 
                caption: { font: new PdfTrueTypeFont(base64ThaiFont, 10) }, 
                record: { font: new PdfTrueTypeFont(base64ThaiFont, 9) } 
            } 
        }; 
       this.grid.pdfExport(pdfExportProperties); 
    } 
} 
} 



NOTE: We have used TURKISH-regular font . If you have any custom font you can convert it to base64  and replace it in ‘base64_Turkishfont’

Regards, 
Seeni Sakthi Kumar S 



KD kenan dogan September 7, 2019 03:20 PM UTC

Thank you, You're perfect :)


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team September 9, 2019 12:12 PM UTC

Hi Kenan,  
  
Thanks for your update.

We are happy to hear that your requirement has been achieved and you are good to go. Please get back to us, if you require further assistance.

Regards,  
Seeni Sakthi Kumar S 


Loader.
Live Chat Icon For mobile
Up arrow icon