The onBeforeRowHeaderExport event handler fires during image and Excel export. It lets you customize the Gantt Chart row header content and appearance in the exported image.
Available since version 2023.1.5529.
Declaration
DayPilot.Gantt.onBeforeRowHeaderExport(args)Parameters
args.areas(DayPilot.AreaData[]): active areas for image exportargs.task- exported task (DayPilot.Task).args.columns(array) - exported row header columns.args.textPadding(number): horizontal text padding in pixels for image exports. The default is7.args.text(string) - exported text.args.backColor(string) - background color.args.borderColor(string) - border color.args.fontSize(string) - font size.args.fontFamily(string) - font family.args.fontStyle("normal"|"italic"|"bold") - font style.args.fontColor(string) - font color.args.horizontalAlignment("left"|"center"|"right") - horizontal text alignment.args.verticalAlignment("top"|"center"|"bottom") - vertical text alignment.
args.columns contains the exported visible row-header cells, including the first cell; it excludes column titles.
Column properties (args.columns[x]):
areas(DayPilot.AreaData[]): active areas for this exported cellbackColorfontColorfontFamilyfontSizefontStylehorizontalAlignmentverticalAlignmenttextPadding(number): overrides the row-level inset for this cell in image exports.text
Notes
If the row header uses multiple columns, customize each exported column separately using args.columns[x].
Image Export Text Padding
Image exports (SVG, PNG, and JPEG) use 7 pixels of horizontal padding inside each row-header cell by default. Set args.textPadding for the row and args.columns[index].textPadding to override one visible column. Set either value to 0 to remove that inset. Column titles keep the default inset. Available since 2026.4.7169.
Active Areas in Image Export
For PNG, JPEG and SVG export, args.areas contains copies of the active-area descriptors prepared for this item. Replace it or assign [] to change only the exported areas. The export does not call an area’s onAfterRender DOM callback. Custom HTML remains outside the supported image-export representation.
Top-level args.areas addresses the first cell, or a merged parent header. Replacing it takes precedence over args.columns[0].areas. To suppress every row-header area, clear both the top-level array and each column array.
args.areas = [];
args.columns.forEach(column => { column.areas = []; });Examples
Uses the original row name instead of HTML:
JavaScript
const gantt = new DayPilot.Gantt("dp", {
onBeforeRowHeaderExport: (args) => {
args.text = args.task.text();
args.textPadding = 12;
if (args.columns[1]) {
args.columns[1].textPadding = 4;
}
},
// ...
});
gantt.init();Angular
<daypilot-gantt [config]="config"></daypilot-gantt>config: DayPilot.GanttConfig = {
onBeforeRowHeaderExport: args => {
args.text = args.task.text();
args.textPadding = 12;
if (args.columns[1]) {
args.columns[1].textPadding = 4;
}
},
// ...
};React
<DayPilotGantt
onBeforeRowHeaderExport={onBeforeRowHeaderExport}
/>const onBeforeRowHeaderExport = (args) => {
args.text = args.task.text();
args.textPadding = 12;
if (args.columns[1]) {
args.columns[1].textPadding = 4;
}
};Vue
<DayPilotGantt
:onBeforeRowHeaderExport="onBeforeRowHeaderExport"
/>const onBeforeRowHeaderExport = (args) => {
args.text = args.task.text();
args.textPadding = 12;
if (args.columns[1]) {
args.columns[1].textPadding = 4;
}
};See Also
Client-Side Image Export [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot