The onBeforeCellExport event handler fires during Excel and image export (JPEG, PNG, SVG) and direct printing. It lets you provide alternative text for Scheduler grid cells because image export doesn't support HTML in grid cells.
Declaration
DayPilot.Scheduler.onBeforeCellExport(args)Parameters
args.areas(array) - active areas copied from onBeforeCellRender (available since 2021.4.5168)args.cell- exported grid cell object (read-only)args.fontColor(string) - font color (available since 2021.4.5168)args.fontFamily(string) - font family (available since 2021.4.5168)args.fontSize(string) - font size (available since 2021.4.5168)args.fontStyle(string) - font style (available since 2021.4.5168)args.format(string) - target format set using exportAs() (read-only, available since version 2025.1.6393)args.text(string) - exported textargs.horizontalAlignment(string) -"left","center", or"right"args.backColor(string) - background color
Notes
The export prepares cell content using onBeforeCellRender before calling this handler. Use this handler for export-only text or appearance changes.
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.
Examples
JavaScript
Basic HTML-to-text conversion that replaces line breaks.
const scheduler = new DayPilot.Scheduler("dp", {
onBeforeCellExport: (args) => {
const html = args.cell.properties.html || "";
args.text = html.replace("<br>", "\n");
},
// ...
});
scheduler.init();Angular
<daypilot-scheduler [config]="config"></daypilot-scheduler>config: DayPilot.SchedulerConfig = {
onBeforeCellExport: (args) => {
const html = args.cell.properties.html || "";
args.text = html.replace("<br>", "\n");
},
// ...
};React
<DayPilotScheduler
onBeforeCellExport={onBeforeCellExport}
/>const onBeforeCellExport = (args) => {
const html = args.cell.properties.html || "";
args.text = html.replace("<br>", "\n");
};Vue
<DayPilotScheduler
:onBeforeCellExport="onBeforeCellExport"
/>const onBeforeCellExport = (args) => {
const html = args.cell.properties.html || "";
args.text = html.replace("<br>", "\n");
};See Also
Client-Side Export [doc.daypilot.org]
Printing [doc.daypilot.org]
DayPilot.Scheduler.onBeforeCellRender
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot