The onBeforeEventExport event handler fires by the monthly calendar during image and Excel export and direct printing. It lets you provide alternative text instead of HTML and customize the formatting.
Declaration
DayPilot.Month.onBeforeEventExport(args)Parameters
args.areas(DayPilot.AreaData[]): active areas for image exportargs.e- exported event object (read-only)args.text- exported event textargs.fontSize- font sizeargs.fontFamily- font familyargs.fontStyle- font styleargs.fontColor- font colorargs.backColor- background colorargs.borderColor- border colorargs.horizontalAlignment("left"|"right"|"center") - horizontal text alignment
Notes
Use args.text when the live event content contains HTML but the exported or printed output should use a plain-text fallback. The remaining properties let you override colors, fonts, borders, and alignment for each exported event box.
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
const month = new DayPilot.Month("dp", {
onBeforeEventExport: (args) => {
args.text = args.text.toUpperCase();
args.horizontalAlignment = "center";
},
// ...
});
month.init();Angular
<daypilot-month [config]="config"></daypilot-month>config: DayPilot.MonthConfig = {
onBeforeEventExport: (args) => {
args.text = args.text.toUpperCase();
args.horizontalAlignment = "center";
},
// ...
};React
<DayPilotMonth
onBeforeEventExport={onBeforeEventExport}
/>const onBeforeEventExport = (args) => {
args.text = args.text.toUpperCase();
args.horizontalAlignment = "center";
};Vue
<DayPilotMonth
:onBeforeEventExport="onBeforeEventExport"
/>const onBeforeEventExport = (args) => {
args.text = args.text.toUpperCase();
args.horizontalAlignment = "center";
};See Also
Client-Side Image Export [doc.daypilot.org]
Printing [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot