Export Service Excel incomplete

Heyo,
we’ve upgraded from Gantt to 8.0.6 → 9.1.1 and started using split-tasks.
Previously our export service worked fine, now only PDFs are exported correctly. XLSX has two problems:

  1. We need to disable both visuals and cellColors, otherwise we get the following error: TypeError: Cannot read properties of null (reading ‘currentStyle’)
  2. The excel export doesn’t export any tasks anymore, eventhough in both the Gantt and the PDF export they are visible.



Hello Hendrik,
The support of split tasks in Excel export was added only in the 9.1 version:

In earlier versions, you would get an error:
https://snippet.dhtmlx.com/mjitco3p

I see that you have custom colors at least in the dark theme. So, I tried to reproduce the issue by using different ways of the configuration, but the tasks with custom colors are exported correctly:
https://snippet.dhtmlx.com/4y9pi2to

https://snippet.dhtmlx.com/gzm5rmsd

Probably, the issue is related to the Gantt configuration, but it is hard to suggest what might be wrong as I don’t see your code.
Please add your configuration to the snippet and make sure that the issue is reproduced there. Then, click on the Save button and send me the link.
Or send me a ready demo with all the necessary JavaScript and CSS files so that I can reproduce the issue locally.

Hey ramil,
thanks for your quick response.
We are using the offline export service.

When taking your code, and integrating it into our setup with the online export it works,
but when switching to the offline export, it doesn’t work correctly anymore.

      gantt.plugins({
    export_api: true,
    keyboard_navigation: true,
    undo: false,
    tooltip: true,
    multiselect: true,
    marker: true,
    drag_timeline: true,
  });

const tasks = {
  data: [
    { id: '10', text: 'Project #1', render: 'split', start_date: '01-04-2025', duration: 3, progress: 0.4 },
    {
      id: '1',
      text: 'Task #1',
      color: 'yellow',
      start_date: '01-04-2025',
      duration: 1,
      progress: 0.6,
      parent: '10',
    },
    {
      id: '2',
      text: 'Task #2',
      color: '#f9dd7b',
      start_date: '03-04-2025',
      duration: 1,
      progress: 0.6,
      parent: '10',
    },
    {
      id: '20',
      text: 'Project #2',
      render: 'split',
      start_date: '01-04-2025',
      duration: 3,
      progress: 0.4,
      type: 'project',
    },
    {
      id: '3',
      text: 'Task #3',
      color: 'yellowgreen',
      start_date: '01-04-2025',
      duration: 1,
      progress: 0.6,
      parent: '20',
    },
    {
      id: '4',
      text: 'Task #4',
      color: 'goldenrod',
      start_date: '02-04-2025',
      duration: 1,
      progress: 0.6,
      parent: '20',
    },
  ],
  links: [
    { id: 1, source: 1, target: 2, type: '0' },
    { id: 2, source: 2, target: 3, type: '0' },
    { id: 3, source: 3, target: 4, type: '0' },
    { id: 4, source: 2, target: 5, type: '0' },
  ],
};

gantt.locale.labels.section_split = 'Display';
gantt.config.lightbox.project_sections = [
  { name: 'description', height: 70, map_to: 'text', type: 'textarea', focus: true },
  {
    name: 'split',
    type: 'checkbox',
    map_to: 'render',
    options: [{ key: 'split', label: 'Split Task' }],
  },
  { name: 'time', type: 'duration', map_to: 'auto' },
];

gantt.config.open_split_tasks = true;

gantt.init('gantt_here');
gantt.parse(tasks);

gantt.exportToExcel({
visual: true,
server: getCurrentUrl(href) + ‘/export’,
callback: async function (res: any) {
console.log(‘:rocket: ~ exportExcel ~ res:’, res);
await downloadFile(res, href, ‘solid-hour-gantt.xlsx’);
},
});

With the offline export service, our xlsx is just a JSON object.


Hello Hendrik,
Thank you for the clarification.
The support of split tasks was added in the 0.7.1 version of the PDF Export Module. If you try to do that in an earlier version, you get an error message instead of the file:

Internal server error. Error: Gantt to Excel. TypeError: excelRefs variable sent to mergeCells function must be an array with length > 0

I checked that if you use the callback function, there is a JSON request instead of the error message (because the error message is returned to the opened tab).

It seems the issue here is that in the earlier Gantt versions, the split tasks were ignored when preparing the request for the export server. So, the timeline part was exported as usual. Starting from the 9.1 version, Gantt saves the split task data, and the old export module just doesn’t have the relevant code to process it. Though, the same error can be returned for some other scenarios.

The issue should be fixed when you update the export module.
The older versions of the export module may not work correctly with the 9.1 version for PDF export in some scenarios because they are missing the templates.

So, I recommend updating the PDF Export Module at least to the 0.7.3 version, though, newer versions are more preferable because of the fixes and improvements they contain.