Skip to main content

PivotGridControl.ExportToHtml(String, String) Method

Exports the Pivot Grid Control’s data to a HTML file with the specified encoding.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v22.2.dll

NuGet Package: DevExpress.Win.PivotGrid


public void ExportToHtml(
    string filePath,
    string htmlCharSet


Name Type Description
filePath String

A String containing the full path (including the file name and extension) specifying where the HTML file will be created.

htmlCharSet String

A String representing the encoding name set in the HTML file (e.g. “UTF-8”).


This method overwrites any files present at the specified path that have the same name without warning. Note that the .html (or an appropriate) extension has to be specified in the path.

To decrease the size of the created HTML file (remove secondary symbols), use the ExportToHtml method with the compressed parameter set to true.

Note: the Pivot Grid Control’s data can only be exported if the XtraPrinting Library is available. Use the PivotGridControl.IsPrintingAvailable property to check whether the grid’s data can be exported.


The following example demonstrates how to export the Pivot Grid Control’s data to HTML documents using Unicode (UTF-8) and Western European (ISO) encodings. The encoding name is passed via the htmlCharSet parameter.

// Exports to an HTML file using the UTF-8 Unicode encoding.
pivotGridControl1.ExportToHtml("OutputUnicode.html", "utf-8", 
  "Unicode UTF-8 Example", false);

// Exports to an HTML file using the Western European ISO encoding.
pivotGridControl1.ExportToHtml("OutputIso.html", "iso-8859-1", 
  "Western European ISO Example", true);
See Also