Skip to main content

PivotGridControl.ExportToHtml(String, String, String, Boolean) Method

Exports the Pivot Grid Control’s data to an HTML file with the specified encoding and title. The output file can be compressed (secondary characters e.g. spaces are removed) if required.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v22.2.dll

NuGet Package: DevExpress.Win.PivotGrid


public void ExportToHtml(
    string filePath,
    string htmlCharSet,
    string title,
    bool compressed


Name Type Description
filePath String

A String which contains 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”).

title String

A String specifying the name shown as the title of the created HTML document.

compressed Boolean

true to compress the HTML code (secondary characters e.g. spaces are removed); otherwise, false.


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. HTML code in the compressed form doesn’t contain any secondary symbols such as Space or Carriage Return symbols.

Note: the Pivot Grid Control’s data can be exported only 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