Gantt Export options are not working with Angular 9

Export to PDF/Excel/MSProject features are not working. Getting following two issues

`Uncaught ReferenceError: gantt is not defined
at api.js:31
at api.js:584

core.js:5828 ERROR TypeError: dhtmlx_gantt__WEBPACK_IMPORTED_MODULE_2__.gantt.exportToPDF is not a function`

Am using Angular 9 & Gantt 7.1.5

Please help me to resolve this error.

Hello Kiran,
You need to add the export’s api.js file into the folder with the Gantt component. Then you need to import that file.
Here is an Angular 9 demo:
https://files.dhtmlx.com/30d/97f9408ca0d5b84902b03589b45ecd04/angular9+export.zip

Update
Starting from the 8.0 version, the export API is included into Gantt, so, you can enable the export functionality by using the plugins method:
https://docs.dhtmlx.com/gantt/whatsnew.html#x6751x80x6752x:~:text=The%20export%20API%20is%20included%20into%20gantt.plugins%20and%20no%20longer%20requires%20adding%20additional%20JS%20file.%20Check%20the%20Migration%20article

Here is an Angular demo where you can check how it works:
https://files.dhtmlx.com/30d/3cdd270de52ad1b594a90772bf63f0d6/angular16+export-to-PDF-and-Excel.zip

1 Like

Thanks @ramil, it is working as expected.