I have a problem when exporting my Gantt to pdf/png.
I get all my styles and pass them to the export function, but these do not apply to the table part, because in the grid_row_class function I add a class (‘has-children’) to bold the row text in case of containing children.
I checked and that class was passed to the header of the export function and set raw to true.
I share export function code
const me = this
const styles = []
for (const itemStyle in document.styleSheets) {
const rules = (document.styleSheets[itemStyle]).cssRules
for (const rule in rules) {
styles.push(rules[rule].cssText)
}
}
this.ganttComponent[exportFile.split(‘/’)[1]]({
name: test.${exportFile.split('/')[0]},
locale: me.$i18n.locale,
header: ‘’ + styles.join(’ ') + ‘’,
raw: true
})
I also share what is observed in the Gantt in the browser:
Hello Agustin,
It may not work if you specify the selector for the parent container for Gantt.
For example, if your Gantt is located inside a div element with the “container” class name and the whole style looks like this:
In that case, the style is applied only when Gantt is located inside that container.
But the export module has the Gantt container without the parent element with the same class name, so the styles are not applied.
If that doesn’t help you, it is hard to suggest what might be wrong as I don’t see your code. In that case, please add your configuration to the following 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.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan