The onBeforeEventExport event handler fires during image/Excel export. Use it to provide alternative plain-text content for the exported event box because image export doesn't support HTML in event boxes.
Declaration
DayPilot.Calendar.onBeforeEventExport(args)Parameters
args.areas- array of active areas (since 2025.4.6770)args.backColor- background colorargs.barBackColor- duration bar background colorargs.barColor- duration bar colorargs.barWidth- duration bar width in pixelsargs.borderColor- event border colorargs.e(DayPilot.Event) - exported eventargs.fontColor- event font colorargs.fontFamily- event font familyargs.fontSize- font sizeargs.fontStyle- event font styleargs.horizontalAlignment("left"|"right"|"center") - text alignmentargs.text- exported text
Notes
Use args.text when the interactive event uses rich HTML but the export needs a plain-text fallback. The callback also exposes the exported colors, fonts, alignment, duration bar styling, and active areas so you can tune the image output for each event.
Examples
JavaScript
const calendar = new DayPilot.Calendar("dp", {
onBeforeEventExport: (args) => {
args.text = args.e.client.html().replace("<br>", "\n");
},
// ...
});
calendar.init();Angular
<daypilot-calendar [config]="config"></daypilot-calendar>config: DayPilot.CalendarConfig = {
onBeforeEventExport: (args) => {
args.text = args.e.client.html().replace("<br>", "\n");
},
// ...
};React
<DayPilotCalendar
onBeforeEventExport={onBeforeEventExport}
{/* ... */}
/>const onBeforeEventExport = (args) => {
args.text = args.e.client.html().replace("<br>", "\n");
};Vue
<DayPilotCalendar
@beforeEventExport="onBeforeEventExport"
<!-- ... -->
/>const onBeforeEventExport = (args) => {
args.text = args.e.client.html().replace("<br>", "\n");
};See Also
Client-Side Export [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot