DayPilot.Month.onBeforeHeaderExport

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 index

  • args.backColor - background color

  • args.fontSize - font size

  • args.fontFamily - font family

  • args.fontStyle - font style

  • args.fontColor - font color

  • args.horizontalAlignment ("left" | "center" | "right") - horizontal text alignment

  • args.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]

DayPilot.Month Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript