Interface Exporting


public interface Exporting

Exporting

Smart GWT can export both the data behind components and the visual appearance of components, through a family of APIs that share formatting rules and delivery mechanics. This topic maps the family; each linked API documents its own details.

Data vs. visuals

Exporting data produces spreadsheet / CSV / JSON / XML output built from records — the subject of the rest of this topic. Exporting visuals produces a PDF or image of components as rendered: see RPCManager.exportContent() for print-quality PDF of any component tree, RPCManager.exportImage() for images of drawn content, and the Printing overview for the underlying system.

Exporting one component's data

The central choice is whose values the file holds:
  • exportData() is server-driven: the server re-runs the component's fetch and builds the file from stored values — the full filtered dataset, not just the rows loaded on the client. Configure it through DSRequest export properties and field-level export attributes.
  • exportClientData() is client-driven: the data is gathered exactly as displayed — formatters, formula and summary fields, hilites — and the server only converts it to the requested file format.
The rules for when declared formats apply during each kind of export, and how to override them, are the subject of Export Value\n Formatting. A DataSource can also export with no component involved, via DataSource.exportData().

Exporting many components — one workbook

Canvas.exportDescendantData() exports every eligible DataBoundComponent beneath a container as one multi-sheet Excel workbook, led by a cover sheet stating the filters that narrow each sheet. Components control their participation and naming declaratively (shouldExport, exportTitle), and exportAsDisplayed switches a component's sheet to the same as-displayed gathering exportClientData() uses. See Descendant Data Export for the full treatment.

Components that reshape their export

A component's faithful export is not always its raw fetched records. Each component contributes its sheet through getExportSpec(), returning an ExportSpec: the sheet's columns and caption, plus its data either by reference (a fetch the server executes) or by value (rows computed on the client). Override it to substitute a semantically richer table — the shipped example is FacetChart, which exports the table its chart conveys rather than its raw fetch: see Chart Data Export.

Formats and delivery

ExportFormat lists the file formats and ExportDisplay chooses download versus inline display. DataSource.exportMultiSheetData() is the multi-sheet engine's entry point for assembling a workbook programmatically.
See Also: