Export to MS Project on the node js servers


#1

Hey there,

We have purchased the enterprise license, and the gantt nodejs server module separately. We wish to export a gantt to MS Project via the server. But it seems that the exportToMsProject function is not available on the nodejs server version of the gantt lib.

Am I missing anything? should it be available? Can I make the request to the export service by myself without the nodejs lib?

Thanks in advance for your help.


#2

Hello,
There are 2 versions of Gantt:

  1. Gantt that you can only run inside the browser. You can add it to an HTML page or use it in React, Angular, Vue.
  2. Gantt for node.js that you can only run on the server.

Both versions themselves cannot convert the data to MS Project or PDF files.
To use the import and export functionality, you need to connect the export’s api.js file:
https://docs.dhtmlx.com/gantt/desktop__export_msproject.html
http://export.dhtmlx.com/gantt/api.js
This file has functions that depend on the browser, so, it won’t work in the node.js environment out of the box.
I tried to modify the code in the file, but it seems that some internal Gantt methods would require the browser functions. I will let the dev team know about it, but I cannot give you any ETA on when it is going to be fixed.

You can manually send the request to the export server, but you need to send it in a specific format. Unfortunately, we don’t have ready guides on how to do that.

However, if you have the PDF export module, which is a node.js application and you want to export the data using your server, the PDF export module doesn’t have that functionality. For that purpose, you need to use the MSP Export module that can only run on the Windows platform.


#3

Many thanks Ramil!

Looking at the api code you’ve mentioned it seems that it is indeed intended to work in a browser. It creates a form element and injects it to the DOM. It might be possible to get it work using a virtual dom package for NodeJS but seems a bit of a long shot. It’s probably possible to get it to work using puppeteer but the overhead of using a headless browser seems a bit of an overkill.

I’ll try to send a request to the export service and get it to work that way.

Thanks again.