| sidebar_label | png() |
|---|---|
| title | JavaScript Grid - png Method |
| description | You can explore the png export method of Grid in the documentation of the DHTMLX JavaScript UI library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Suite. |
@short: Exports data from a grid to a PNG file
@signature: {'png(config?: IPNGConfig) => Promise;'}
@returns: A promise of data export
@params:
config- (optional) an object with export settings. You can specify the following settings for export to PNG:url?: string- (optional) the url of the service that executes export and returns an exported file. This setting is optional, you should use it only if you need to specify the path to your local export service. The default value ishttps://export.dhtmlx.com/grid/png/9.3.0name?: string- (optional) the name of the exported filetheme?: string- (optional) the exported theme, "light" by default. For custom or overridden themes, enable theexportStylesoptionexportStyles?: boolean | string[]- (optional) defines the styles that will be sent to the export service when exporting Grid. Use false to prevent all styles from being sent to the export serviceheader?: string- (optional) an HTML template for the header in the exported filefooter?: string- (optional) an HTML template for the footer in the exported file
:::note
You can specify extended export configuration settings via the Grid exportConfig configuration property.
:::
@example: // default export grid.export.png() .then(() => console.log("success")) .catch(() => console.log("failure")) .finally(() => console.log("finished"));
// export with config settings grid.export.png({ theme: "dark", }) .then(() => console.log("success")) .catch(() => console.log("failure")) .finally(() => console.log("finished"));
@descr:
:::info If you use Grid in conjunction with Pagination, only the displayed page will be exported. :::
Related sample: Grid. Export to PDF/PNG
Related article: Exporting Grid
Related API: exportStyles
Change log:
- The method returns a promise of data export since v9.3
- The header and footer options of the export object were added in v8.4
- Added in v8.1