In calling gantt.exportToExcel() method and specifying ‘columns’ using
- ‘id’ - (string/number) a property of the event that will be mapped to the column
- ‘header’ - (string) the column header
- ‘width’ - (number) the column width in pixels
any custom column template-ing is ignored and the ‘raw’ column values are exported.
This would be very useful to pre-format the excel file for easy import to MS Project, as Ms Project auto-maps columns with specific names.
please show us some code of what you’re doing
You can use this snippet to prepare a demo
add needed code and press “Share” button to generate a link to the sample
Gantt must calculate column templates during export. Also, if you need to have a different kind of output for export, you can use a switch in the template, like follows
if (gantt.exportMode) return "data for export";
return "data for normal rendering";
Problem can occurs if you are using very old version of the Gantt ( 2.x )
Hi, I’ve just made an example with the Stanislav’s code suggestion and I could not afford to make it work.
Could you clarify me what’s not working with my code? ( docs.dhtmlx.com/gantt/snippet/9a8c34b8 ).
I was expecting it to bring me a .xlsx file with the title column with the suffixes.
In this case you could try to redefine gantt columns to one that you want to export and then set it back.
It worked Sten. Thank you!