The onBeforeCellExport event handler fires during image and Excel export and direct printing in the monthly calendar. It lets you provide alternative text instead of HTML and customize the formatting.
Declaration
DayPilot.Month.onBeforeCellExport(args)Parameters
args.areas(DayPilot.AreaData[]): active areas for image exportargs.cell.start- cell start (read-only)args.cell.end- cell end (read-only)args.backColor- exported cell background colorargs.text- exported plain-text cell contentargs.horizontalAlignment("left"|"right"|"center") - horizontal alignment in the exported output
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", {
onBeforeCellExport: (args) => {
args.text = args.cell.start.toString("d");
args.horizontalAlignment = "center";
},
// ...
});
month.init();Angular
<daypilot-month [config]="config"></daypilot-month>config: DayPilot.MonthConfig = {
onBeforeCellExport: (args) => {
args.text = args.cell.start.toString("d");
args.horizontalAlignment = "center";
},
// ...
};React
<DayPilotMonth
onBeforeCellExport={onBeforeCellExport}
/>const onBeforeCellExport = (args) => {
args.text = args.cell.start.toString("d");
args.horizontalAlignment = "center";
};Vue
<DayPilotMonth
:onBeforeCellExport="onBeforeCellExport"
/>const onBeforeCellExport = (args) => {
args.text = args.cell.start.toString("d");
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