The exportAs() method exports the Scheduler in the specified format ("svg", "png", "jpeg", "xlsx").
Export to Excel spreadsheet (XLSX) is supported since version 2025.1.6418.
Declaration
DayPilot.Scheduler.exportAs(format[, options]);Parameters
format- export format:"svg","png","jpeg", or"xlsx"options.area- exported area:"viewport","full", or"range"; the default value is"viewport"options.dateFrom- start date (applies only toarea: "range")options.dateTo- end date (applies only toarea: "range")options.resourceFrom- start resource (applies only toarea: "range")options.resourceTo- end resource (applies only toarea: "range")
Image export options:
options.quality- output JPEG quality (applies only toformat: "jpeg"); the default value is0.92options.scale- output scale; the default value is1(use2for 200% output)
Excel export options:
options.mime- custom MIME type for the exported file; the default value is"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"options.transformWidth- function that converts a pixel value to Excel column width units; the default value is(width) => (width - 5) / 7options.transformHeight- function that converts a pixel value to Excel row height units; the default value is(height) => height * 0.75
Return Value
Returns a DayPilot.Export object that provides the following methods:
toElement()- returns a DOM element with the exported image (<svg>or<img>)toHtml()- returns the DOM element as HTMLtoDataUri()- returns a data URI string (SVG or image data)toBlob()- returns aBlobobjectdownload(filename)- initiates immediate download of the exported imageprint()- prints the exported image using the browser print dialog
For Excel export, the returned object has only the following methods:
download(filename)- initiates immediate download of the XLSX filetoBlobAsync()- returns aPromise<Blob>object
Example
const image = dp.exportAs("png", { area: "full" });
image.download("scheduler.png");
const spreadsheet = dp.exportAs("xlsx");
spreadsheet.download("scheduler.xlsx");See Also
Client-Side Export [doc.daypilot.org]
Client-Side Excel Export [doc.daypilot.org]
Client-Side PNG Export [doc.daypilot.org]
Client-Side JPEG Export [doc.daypilot.org]
Client-Side SVG Export [doc.daypilot.org]
Printing [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot