Flexmonster Software License Agreement (“Agreement”) has been revised and is effective as of September 30, 2025.
The following modifications were made:
The modified version of Agreement is available here.
Downloading, installing, and/or continuing to use Flexmonster Software after September 30, 2025, constitutes Licensee’s acceptance of the terms and conditions of the modified version of Agreement. If Licensee does not agree to any of these terms and conditions, they must cease using Flexmonster Software and must not download, install, use, access, or continue to access Flexmonster Software. By continuing to use Flexmonster Software or renewing the license or maintenance after the effective date of these modifications to Agreement, Licensee accepts and agrees to be bound by the terms and conditions of the modified Agreement.
All current data from the grid or chart can be exported to various formats. By default, content is exported as a file to a user's device, but you can also export it to your server or customize how the exported content is handled.
Note that there are specifics of exporting reports. To see different examples of exporting the report, visit our Examples page.
In Flexmonster, you can also save, share, or print your report.
You can export the report via UI or using an API call:
Step 1. Open a view that you want to export. It can be one of the following:
"grid_charts" or by calling the showGridAndCharts method.Note If you export a chart view to Excel or CSV, the grid view will be exported instead.
Step 2. Select Export () on the Toolbar and choose the export format:

To export the report programmatically, use the exportTo() API call. Its first parameter, type, defines the type of export. For example:
pivot.exportTo("pdf");You can also configure different export parameters using the second exportTo() parameter, the params object, and specify a callbackHandler, a function that is called when the data is ready to be exported.
By default, the report contents are exported as a file to the local file system. To save the report to the server:
"server" in exportTo().Example:
pivot.exportTo("pdf", {
destinationType: "server",
url: "<url_to_your_server>",
requestHeaders: {
Authorization: "Basic " + btoa("<your_username>:<your_password>")
}
});To export Flexmonster reports in headless browsers, we recommend using Puppeteer. This approach provides more flexibility in exporting. For example, you can schedule automatic sending of the exported report to others (e.g., via email).
We prepared a sample GitHub project with Flexmonster and Puppeteer. There are two versions of the project: the main version uses Flexmonster from our CDN, while the other version includes Flexmonster from the npm package.
To run the sample project, follow the steps below:
Step 1. Download or clone the needed version of the sample project:
Get the sample project where Flexmonster is included from CDN:
git clone https://github.com/flexmonster/pivot-puppeteer cd pivot-puppeteer
Get the sample project where Flexmonster is included from npm:
git clone -b flexmonster-from-nodemodules https://github.com/flexmonster/pivot-puppeteer cd pivot-puppeteer
Step 2. Install the npm dependencies described in package.json:
npm install
Step 3. Run the project:
npm start
When the export is complete, find the saved files in the storage/ folder.
Now let's have a look at the project files' contents to understand how the sample project works:
The index.html file contains the pivot table subscribed to the ready, reportcomplete, and exportcomplete events. These events will notify us when the report is ready to be exported and when the export is finished.
When the component triggers one of these events, the dispatchEvent() method triggers the same event for the browser window. This approach allows the browser to handle the component's events in its scope.
You can specify other Flexmonster events similarly.
The pivot.js file runs the browser and performs the export. This section describes its key points.
In the sample project, we use ready, reportcomplete, and exportcomplete events to export the report. You can modify the event handlers to add new functionality, such as scheduled sending of the exported report via email. Other Flexmonster events can be added in a similar way — check it out.
The next important part of the project is where we set a report. It's done using the setReport() function as soon as the component is initialized. You can replace the default report with an inline report or a link to it.
The exportTo() function supports changing the file name or exporting the report to your server - just specify the corresponding export parameters. The structure of the parameters is the same as in the flexmonster.exportTo() API call.
For technical details on how the export is performed, see comments in the pivot.js file.
To specify the name of the resulting file, use the params.filename property. For example:
pivot.exportTo("pdf", {
filename: "flexmonster.pdf"
});To specify a header and footer text in the exported file, use the params.header and params.footer properties respectively. Check out the specifics of setting headers and footers for different export types:
params.header and params.footer can be specified as a regular string or as an HTML string with tags, inline styles, and Base64 images. The HTML is rendered in the browser and added as an image to the exported file.##CURRENT-DATE## and ##PAGE-NUMBER## tokens in the string. They will be replaced with actual values during the export process.Example:
pivot.exportTo("pdf", {
header: "##CURRENT-DATE##",
footer: "<div>##PAGE-NUMBER##</div>",
});
"\n" character: "Row1\nRow2\nRow3".params.header or params.footer spans multiple columns in the exported Excel file, with a maximum of 10 columns. This ensures that the header is always visible to a user.pivot.exportTo("excel", {
header: "First header row\nSecond header row",
footer: "Table Footer",
});
"\n" character: "Row1\nRow2\nRow3".Example:
pivot.exportTo("csv", {
header: "First header row\nSecond header row",
footer: "Table Footer",
});
params.header and params.footer can be specified as a regular string or as an HTML string with tags, inline styles, and Base64 images. The HTML is rendered in the browser and added as an image to the exported file.##CURRENT-DATE## token in the string. It will be replaced with actual values during the export process.Example:
pivot.exportTo("html", {
header: "##CURRENT-DATE##",
footer: "<div style='color:#df3800'>##PAGE-NUMBER##</div>",
});When exporting the report to PDF, you can additionally configure the following:
Check out the example of saving the report as a local PDF file:
const params = {
fontUrl: "https://cdn.flexmonster.com/fonts/NotoSansCJKtc-Regular.ttf",
pageFormat: "A3",
pageOrientation: "landscape"
};
pivot.exportTo("pdf", params);When exporting the report to Excel, you can additionally configure the following:
Check out the example:
const params = {
excelSheetName: "Report",
showFilters: true,
useOlapFormattingInExcel: false
};
pivot.exportTo("excel", params);In the exported Excel file, separators for thousands and decimals are taken from your system's regional settings instead of the thousandsSeparator and the decimalSeparator set in the component.
See how to change the separator for thousands and decimals in Excel.
When exporting the report to Excel, measures will contain at least one decimal place in the output file if they don't have a number format with the explicitly defined decimalPlaces property.
To display the necessary measures as integers, set the decimalPlaces to 0 in the number format for these measures:
report: {
formats: [
{
name: "decimalFormat",
decimalPlaces: 0
}
],
slice: {
measures: [
{
uniqueName: "Price",
aggregation: "sum",
format: "decimalFormat"
},
],
// Other slice properties
},
// Other configs
}Alternatively, all measures can be displayed as integers in the output file if you set the decimalPlaces to 0 in the default number format.
"date string", "datetime", and "time" fields selected for measures will use the default Excel format in the exported file instead of the datePattern, dateTimePattern, and timePattern formats. See how to create a custom date or time format in Excel.When you export the report to Excel, consider the following specifics:
"date string", "datetime", and "time" fields selected for measures will use the default Excel format in the exported file instead of the datePattern, dateTimePattern, and timePattern formats. See how to create a custom date or time format in Excel.When exporting the report to CSV, you can additionally configure the following:
Note If you export a chart view to CSV, the grid view will be exported instead.
See an example:
const params = {
alwaysEnclose: true,
fieldSeparator: ";",
};
pivot.exportTo("csv", params);To customize how exported data is handled, set params.destinationType to "plain". As a result, the exported content is passed to the callbackHandler and can be modified, merged, or saved in any format you need.
For example, if you have multiple Flexmonster instances, you may want to export data from them into one file. Check out how to merge export results for a CSV export:
function doubleExportCsv() {
// Export report from the 1st Flexmonster instance
pivot1.exportTo(
"csv",{
destinationType: "plain"
},
csv1 => {
// Export report from the 2nd Flexmonster instance
pivot2.exportTo(
"csv", {
destinationType: "plain"
},
csv2 => {
// Concat data from two reports into one
const mergedCsv = csv1.data + "\n\n" + csv2.data;
// Download the CSV file with two reports using the downloadjs library
download(mergedCsv, "doubleInstances.csv", "text/csv")
},
);
},
);
}In Flexmonster, you can modify or override the functionality of the Export tab. For more details, see how to customize the tab functionality.
When you export the report, consider that the resulting file is static and contains the data that is present on the grid and charts at the moment of exporting. This means the following:
Also, note that the chart view or the grid and charts view can be exported only to PDF, HTML, or an image. If you start exporting a chart view to Excel or CSV, the grid view will be exported instead.
To ensure the best performance when exporting the report, do not switch to other browser tabs, and do not minimize the browser window.
If you are using data or localization with non-Latin characters, ensure you have set UTF-8 encoding for your data or page. This is required to display the exported report file correctly in the component.
Note To correctly export the report with non-Latin characters to PDF, use the exportTo() method with the params.fontUrl property set to the URL that leads to the necessary TTF font file.
By default, if you modify a value cell using the cell.text property, this cell will be exported as a string. If you want such cells to be exported as unformatted numbers, set the useCustomizeCellForData to false.
Note If the cell.text property contains custom HTML code, the useCustomizeCellForData must be set to false. Otherwise, raw HTML code will be displayed in the exported file.