Pdf Export not working with custom number format

Hi Syncfusion Team!

I've tried adding a pdf export to one of my datagrids, but it just throws an "uncaught (in promise)" into the javascript console.
As I've seen, another person had a similar issue which could be resolved by changing the "format" attribute of the column to a "customFormat" attribute.
In that particular instance, it was a date format rather than a number format. Trying to do the same for the number format doesn't seem to work either.
Heres some of the things I tried, neither of them worked:

<e-grid-column field="summeBrutto" format="#,##0.00€"></e-grid-column>


<e-grid-column field="summeBrutto" customFormat="@(new { type ="number", format="#,##0.00€" })"></e-grid-column>



<e-grid-column field="summeBrutto" customFormat="@(new { format="
#,##0.00€" })"></e-grid-column>

Please Advise.

Kind regards

Lukas Knapp

1 Reply 1 reply marked as answer

SM Shalini Maragathavel Syncfusion Team October 7, 2020 01:47 PM UTC

Hi Lukas, 

Greetings from Syncfusion Support. 

Based on your query we found that you are facing script error while exporting to PDF with the mentioned format for the number column. We checked in our sample and we also faced the same issue at our end.  

To overcome the issue your we suggest you to use PdfTrueTypeFont property of the Grid as demonstrated in the below code snippet, 

Index.cshtml 
<ejs-grid id="Grid" dataSource="ViewBag.dataSource" allowPdfExport="true" toolbarClick="toolbarClick" toolbar="@(new List<string>(){"PdfExport"})"  allowPaging="true" height="300"> 
        <e-grid-columns> 
           . . . 
        <e-grid-column field="Freight" headerText="Freight" format="#,##0.00€" textAlign="Right"  width="120"></e-grid-column> 
           . . . 
            </e-grid-columns> 
 
</ejs-grid> 
<script> 
    function toolbarClick(args) { 
        var gridObj = document.getElementById("Grid").ej2_instances[0]; 
        if (args.item.id === 'Grid_pdfexport') { 
            let pdfExportProperties = { 
                theme: { 
 
                    record: { font: new ej.pdfexport.PdfTrueTypeFont(adventProFont, 9) } 
                } 
            }; 
            gridObj.pdfExport(pdfExportProperties); 
        } 
    } 
</script> 

Please find the  below sample for more information. 

Please find the below documentation for more information. 
Please get back to us if you need further assistance. 

Regards, 
Shalini M. 









Marked as answer
Loader.
Up arrow icon