importFromMSProject with angular 7


#1

Hi,

I pretend use dhtmlx to import a msproject file. My projects is in angular 7 and I am using the dhtmlx-gantt npm package to use gantt.
So I need use gantt.importFromMSProject to import project file. but I receive the error: importFromMsProject is not a function.

How do I do this with dhtmlx and angular?


#2

I’m having a similar issue however with the export methods e.g. exportToPDF.

Is there another dhx.gantt package needed?


#3

There are a few things you need to do to use the online export services for an Angular app:

  1. Set allowJS for the compilerOptions
  2. include the following scripts in Index.html - …/assets/dhtmlxgantt.js and https://export.dhtmlx.com/gantt/api.js
  3. In the component, import import ‘…/assets/gantt-api’;

Now, you can call gantt.exportToPDF({});

HTH


#4

Hello everyone,
To export the data, you need to connect the api.js file to use the import and export functions:
https://export.dhtmlx.com/gantt/api.js
As Joubin said, you need to put that file in your project and add import "path to the api.js file". If you put it near the gantt.component.ts file, the import function will look this way:

import "./api.js";

You can check the following demo project to see how it works:
https://files.dhtmlx.com/30d/aad8be77c62b14da73467062a27cfe28/angular7+export.zip


#5

When I’m using https://export.dhtmlx.com/gantt/api.js in my angular app with commercial license, I’m facing the following issues:

  1. the export function works while calling it from my html file and downloads PDF/XML/JPG files of my gantt chart, but when I want to specify something for the function and try to do that in my TS file, i get the error: exportToMsProject is not a function.
  2. also for import from MPP files, same error: importFromMsProject is not a function

Is there a solution to this? Please tell me if you need further info regarding my issue…


#6

Hello Debanjali,
Did you import the export’s api.js file or its contents in your TS file as described in the previous comment?