The onBeforeHeaderExport 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.
Available since 2019.1.3554.
Declaration
DayPilot.Month.onBeforeHeaderExport(args)Parameters
args.header.dayOfWeek(number; 0-6; 0 = Sunday) - header day-of-week indexargs.backColor- background colorargs.fontSize- font sizeargs.fontFamily- font familyargs.fontStyle- font styleargs.fontColor- font colorargs.horizontalAlignment("left"|"center"|"right") - horizontal text alignmentargs.text- exported header text
Notes
Use args.text to provide a plain-text label when the live header content uses HTML. The other properties let you adjust the exported or printed header colors, fonts, and alignment.
Examples
JavaScript
const month = new DayPilot.Month("dp", {
onBeforeHeaderExport: (args) => {
const names = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
args.text = names[args.header.dayOfWeek];
args.horizontalAlignment = "center";
},
// ...
});
month.init();Angular
<daypilot-month [config]="config"></daypilot-month>config: DayPilot.MonthConfig = {
onBeforeHeaderExport: (args) => {
const names = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
args.text = names[args.header.dayOfWeek];
args.horizontalAlignment = "center";
},
// ...
};React
<DayPilotMonth
onBeforeHeaderExport={onBeforeHeaderExport}
{/* ... */}
/>const onBeforeHeaderExport = (args) => {
const names = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
args.text = names[args.header.dayOfWeek];
args.horizontalAlignment = "center";
};Vue
<DayPilotMonth
@beforeHeaderExport="onBeforeHeaderExport"
<!-- ... -->
/>const onBeforeHeaderExport = (args) => {
const names = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
args.text = names[args.header.dayOfWeek];
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