Hello Mariana,
Thank you for sharing the configuration.
I see that you create a custom calendar but don’t apply the settings to the tasks. And then you show values in the grid using the custom calendar while all the tasks have the global calendar. As I said earlier, when you export the data, what you see in the grid doesn’t matter at all. Gantt uses the values from the duration
parameter.
As a result, you get different duration values in MS Project. I couldn’t open the exported files in MS Project because of the duration out of range
error, so I used an online service to compare the difference:
And the
_getWorktimeSettings
function only modifies the calendar settings for the exported file. It doesn’t affect actual task duration at all.
Unfortunately, right now, you cannot export custom calendars, only the global calendar is exported. If all tasks in the chart have the same calendar, you can copy the calendar settings to the global calendar, but you also need to recalculate the task dates after changing the calendar:
https://docs.dhtmlx.com/gantt/desktop__working_time.html#changingcalendardynamically
Another thing that affects the duration for MS Project are the different working time settings that are not used by Gantt, namely HoursPerDay
and MinutesPerDay
. You need to specify these parameters in the project
parameter of the export function:
https://docs.dhtmlx.com/gantt/desktop__export_msproject.html#:~:text=Getting%20properties%20of%20the%20Project
When you calculate HoursPerDay
for the duration column, you choose the date when the task starts. But the task may start on Sunday where you have 13:14 working hours or it can start on another working day that has only 7:33 working hours. And as a result, you get different results. It doesn’t work that way in MS Project. You need to specify the common value that doesn’t depend on the task date.
After I specified the following settings, I get the same results in the exported file:
gantt.exportToMSProject({
project: {
HoursPerDay: function () {
return 7;
},
MinutesPerDay: function () {
return 7 * 60 + 33;
}
}
})
Here is the updated snippet:
https://snippet.dhtmlx.com/4dxtefcp