The exportAs() method exports the JavaScript Calendar component in the specified image format.
DayPilot.Calendar.exportAs(format[, options]);format: "svg" | "png" | "jpeg" | "xlsx"
options.area - specifies the exported area ("viewport" or "full"); if not specified, "viewport" will be used
Image export:
options.quality - quality of the output JPEG image (applies only to format: "jpeg"); if not specified, 0.92 will be used
options.scale - sets the scale of the output; if not specified, 1 will be used (to magnify the output to 200%, use a value of 2)
Excel export:
options.mime - sets a custom MIME type for the exported file (the default value is "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
options.transformWidth - a function that converts a pixel value to Excel column width units (the default value is (width) => (width - 5) / 7)
options.transformHeight - a function that converts a pixel value to Excel row height units (the default value is (height) => height * 0.75)
Excel export is available since 2026.1.6816. It only supports full grid export (options.area value is ignored).
A DayPilot.Export object that provides the following methods:
toElement() - returns DOM element with the image (<svg> or <img>)
toHtml() - returns DOM element as HTML
toDataUri() - returns a dataURI string (SVG or image data)
toBlob() - returns a Blob object
download(filename) - forces download of the image
print() - prints the exported image using the browser print dialog
For Excel export, the object has only the following methods:
download(filename) - initiates immediate download of the XLSX file
toBlobAsync() - returns a Promise<Blob> object