# Class: Exporting

## Highcharts. Exporting

#### new Exporting(chart)

  The Exporting class provides methods for exporting charts to images. If the exporting module is loaded, this class is instantiated on the chart and available through the `chart.exporting` property. Read more about the exporting module.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `chart` | Highcharts.Chart | The chart instance.

### Methods

#### downloadCSV()

  Generates a data URL of CSV for local download in the browser. This is the default action for a click on the 'Download CSV' button.

  See Highcharts.Exporting#getCSV to get the CSV data itself.

  ##### Requires:

  - module:modules/exporting
  - module:modules/export-data

#### <async> downloadSVG(svg, exportingOptions)

  Get data URL to an image of an SVG and call download on its options object:

  - filename: Name of resulting downloaded file without extension. Default is based on the chart title.
  - type: File type of resulting download. Default is `image/png`.
  - scale: Scaling factor of downloaded image compared to source. Default is `2`.
  - libURL: URL pointing to location of dependency scripts to download on demand. Default is the exporting.libURL option of the global Highcharts options pointing to our server.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `svg` | string | The generated SVG.
  `exportingOptions` | Highcharts.ExportingOptions | The exporting options.

  ##### Requires:

  - module:modules/exporting

#### downloadXLS()

  Generates a data URL of an XLS document for local download in the browser. This is the default action for a click on the 'Download XLS' button.

  See Highcharts.Exporting#getTable to get the table data itself.

  ##### Requires:

  - module:modules/exporting
  - module:modules/export-data

#### <async> exportChart( [exportingOptions] [, chartOptions])

  Submit an SVG version of the chart along with some parameters for local conversion (PNG, JPEG, and SVG) or conversion on a server (PDF).

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `exportingOptions` | Highcharts.ExportingOptions | <optional> | Exporting options in addition to those defined in exporting.
  `chartOptions` | Highcharts.Options | <optional> | Additional chart options for the exported chart. For example a different background color can be added here, or `dataLabels` for export only.

  ##### Requires:

  - module:modules/exporting

  ##### Try it

  - with no options.
  - type and custom filename.
  - to WebP.
  - chart background in export.
  - with Highcharts Stock.

#### getCSV( [useLocalDecimalPoint])

  Returns the current chart data as a CSV string.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `useLocalDecimalPoint` | boolean | <optional> | Whether to use the local decimal point as detected from the browser. This makes it easier to export data to Excel in the same locale as the user is.

  ##### Requires:

  - module:modules/exporting
  - module:modules/export-data

  ##### Returns:

  string .

  CSV representation of the data.

#### getChartHTML( [applyStyleSheets])

  Return the unfiltered innerHTML of the chart container. Used as hook for plugins. In styled mode, it also takes care of inlining CSS style rules.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `applyStyleSheets` | boolean | <optional> | whether or not to apply the style sheets.

  See also:
    - Highcharts.Chart#getSVG

  ##### Requires:

  - module:modules/exporting

  ##### Returns:

  string .

  The unfiltered SVG of the chart.

#### getDataRows( [multiLevelHeaders])

  Returns a two-dimensional array containing the current chart data.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `multiLevelHeaders` | boolean | <optional> | Use multilevel headers for the rows by default. Adds an extra row with top level headers. If a custom columnHeaderFormatter is defined, this can override the behavior.

  ##### Requires:

  - module:modules/exporting
  - module:modules/export-data

  ##### Fires:

  - Highcharts.Chart#event:exportData

  ##### Returns:

  Array.<Array.<(number|string)>> .

  The current chart data

#### getFilename()

  Get the default file name used for exported charts. By default it creates a file name based on the chart title.

  ##### Requires:

  - module:modules/exporting

  ##### Returns:

  string .

  A file name without extension.

#### getSVG( [chartOptions] [, async])

  Return an SVG representation of the chart.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `chartOptions` | Highcharts.Options | <optional> |  | Additional chart options for the generated SVG representation. For collections like `xAxis`, `yAxis` or `series`, the additional options is either merged in to the original item of the same `id`, or to the first item if a common id is not found.
  `async` | boolean | <optional> | false | Whether to get the SVG synchronously or asynchronously. The async mode should be used when additional resources like WebGPU canvas needs to be inlined before getting the SVG. In async mode, `getSVG` returns a Promise.

  ##### Requires:

  - module:modules/exporting

  ##### Fires:

  - Highcharts.Chart#event:getSVG

  ##### Returns:

  string | Promise.<string> .

  The SVG representation of the rendered chart.

  ##### Try it

  - the SVG from a button.

#### getTable( [useLocalDecimalPoint])

  Build a HTML table with the chart's current data.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `useLocalDecimalPoint` | boolean | <optional> | Whether to use the local decimal point as detected from the browser. This makes it easier to export data to Excel in the same locale as the user is.

  ##### Requires:

  - module:modules/exporting
  - module:modules/export-data

  ##### Fires:

  - Highcharts.Chart#event:afterGetTable

  ##### Returns:

  string .

  HTML representation of the data.

  ##### Try it

  - the data from the export menu.

#### hideData()

  Hide the data table when visible.

  ##### Requires:

  - module:modules/exporting
  - module:modules/export-data

#### print()

  Clears away other elements in the page and prints the chart as it is displayed. By default, when the exporting module is enabled, a context button with a drop down menu in the upper right corner accesses this function.

  ##### Requires:

  - module:modules/exporting

  ##### Fires:

  - Highcharts.Chart#event:beforePrint
  - Highcharts.Chart#event:afterPrint

  ##### Try it

  - from a HTML button.

#### viewData()

  View the data in a table below the chart.

  ##### Requires:

  - module:modules/exporting
  - module:modules/export-data

  ##### Fires:

  - Highcharts.Chart#event:afterViewData