Articles in this section

How to export PivotGrid without rendering?

This KB document explains how to export PivotGrid without rendering.

Solution:

The PivotGrid can be exported through form submit without rendering in the web page.

Step 1:

Add the OLAP controller file in your project. Here, it is named as “OLAPController”.

Step 2:

Add the following code in the script tag of your html page.

Code Snippet: [JavaScript]

<script type="text/javascript">
$(function()
{
 
// Use the JSON which you want to export.
 var params = {args: "{"colorSettings:"{"rowCellColor":"rgb(51, 51, 51)","rowCellBGColor":"rgb(255, 255, 255)","columnCellColor":"rgb(51, 51, 51)","columnCellBGColor":"rgb(255, 255, 255)","valueCellColor":"rgb(51, 51, 51)","valueCellBGColor":"rgb(255, 255, 255)","summaryCellColor":"rgb(51, 51, 51)","summaryCellBGColor":"rgba(255, 255, 255, 255)"}"
"currentReport":"", // Define the OLAP report here
 "customObject": "{}", "description": "", "exportOption": "excel", "fileFormat": ".xls", "layout": "normal", "title": ""}"};
 
params = JSON.stringify(JSON.stringify(params)); // Stringified JSON
 
url = "/Olap/Export"; // URL of the Export method
var form = $('<form>').attr({ 'action': url, 'method': 'POST', 'name': 'export' });
var addParam = function (paramName, paramValue) {
var input = $('<input type="hidden" title="params">').attr({
   'id': paramName,
   'name': paramName,
   'value': paramValue
}).appendTo(form);
};
for (var item in params)
  addParam(item, params[item]);
form.appendTo(document.body).submit().remove(); // Pass the export parameters through the form submit
});
</script>

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied