DayPilot.Scheduler.onBeforeCellExport

The onBeforeCellExport event handler fires during Excel and image export (JPEG, PNG, SVG) and direct printing. It lets you provide alternative text for Scheduler grid cells because image export doesn't support HTML in grid cells.

Declaration

DayPilot.Scheduler.onBeforeCellExport(args)

Parameters

  • args.areas (array) - active areas copied from onBeforeCellRender (available since 2021.4.5168)

  • args.cell - exported grid cell object (read-only)

  • args.fontColor (string) - font color (available since 2021.4.5168)

  • args.fontFamily (string) - font family (available since 2021.4.5168)

  • args.fontSize (string) - font size (available since 2021.4.5168)

  • args.fontStyle (string) - font style (available since 2021.4.5168)

  • args.format (string) - target format set using exportAs() (read-only, available since version 2025.1.6393)

  • args.text (string) - exported text

  • args.horizontalAlignment (string) - "left", "center", or "right"

  • args.backColor (string) - background color

Notes

The args object is the same instance that is used in onBeforeCellRender, which is called right before onBeforeCellExport. Use this event to replace browser-only HTML cell content with plain text before exporting or printing.

Examples

JavaScript

Basic HTML-to-text conversion that replaces line breaks.

const scheduler = new DayPilot.Scheduler("dp", {
  onBeforeCellExport: (args) => {
    const html = args.cell.properties.html || "";
    args.text = html.replace("<br>", "\n");
  },
  // ...
});
scheduler.init();

Angular

<daypilot-scheduler [config]="config"></daypilot-scheduler>
config: DayPilot.SchedulerConfig = {
  onBeforeCellExport: (args) => {
    const html = args.cell.properties.html || "";
    args.text = html.replace("<br>", "\n");
  },
  // ...
};

React

<DayPilotScheduler
  onBeforeCellExport={onBeforeCellExport}
  {/* ... */}
/>
const onBeforeCellExport = (args) => {
  const html = args.cell.properties.html || "";
  args.text = html.replace("<br>", "\n");
};

Vue

<DayPilotScheduler
  @beforeCellExport="onBeforeCellExport"
  <!-- ... -->
/>
const onBeforeCellExport = (args) => {
  const html = args.cell.properties.html || "";
  args.text = html.replace("<br>", "\n");
};

See Also

Client-Side Export [doc.daypilot.org]

Printing [doc.daypilot.org]

DayPilot.Scheduler.onBeforeCellRender

DayPilot.Scheduler.exportAs()

DayPilot.Scheduler Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript