So I have an issue.
I have to export data from a pivot table with expanded rows if the user has done so. I need to capture the data exactly as it appears in the pivot table for opening up in Excel.
I cannot use the built in export as in my case the browser is blocked from downloading something. The browser in question is an HTML renderer but it has no ability to download files from the library.
Is there a way to capture exactly what would be sent to the machine on download and send it back to the caller the data in proper CSV or TSV format?
Can I hijack the built in exporter to, rather than download it to the machine, package it up and send it elsewhere?
thanks
Hi Jeremy,
We have checked our built-in CSV exporting option and the pivot table data downloaded properly in the browser as a CSV document format. However, if the browser prevents downloading the document, we believe it may occurs due to the configurations of your browser. Please refer the below sample and UG to know more about the CSV exporting.
Sample: https://stackblitz.com/edit/react-ye4qqb?file=index.js,index.html
UG: https://ej2.syncfusion.com/react/documentation/pivotview/excel-export#csv-export
Furthermore, we can save the pivot table as blob data rather than a downloaded CSV document by setting the "isBlob" option to true in the "excelComplete" event. In the code example below, we used the "csvExport()" function to export the CSV document as blog data by enabling the "isBlob" parameter in the "exportComplete" event. Please refer to the below code example.
Code example:
|
function onClick() { if (mode.value === 'csv') { pivotObj.csvExport(null, false, null, true); } } function exportComplete(args) { args.promise.then((e) => { console.log(e.blobData); }); } |
Output screenshot:
Blob data:
Meanwhile, we have prepared a sample for your reference.
Sample: https://stackblitz.com/edit/react-ye4qqb-ms9jcv?file=index.js,index.html
Please refer the below UG document to know more about “exportComplete" event.
Document: https://ej2.syncfusion.com/react/documentation/pivotview/excel-export#exportcomplete
However, If the problem persists, please reproduce it in the provided sample and revert to us (or) send your runnable sample that reproduces the problem. This would allow us to investigate the reported problem at our end and provide a solution as soon as possible.
Regards,
Angelin Faith Sheeba.
Hello.
Thanks for this "isBlob" information. This solution worked perfectly for me.
For me, the issue isn't that my browser blocks the download, it's that I'm using JS libraries inside of the FileMaker Pro application inside its web viewer object. It is an embedded browser but doesn't have any of the browser capabilities like download or navigation. It essentially just renders an HTML document. I can do almost everything inside of this renderer save download to the browser.
One thing I noticed: in order to get the blob back to FileMaker I'm Base64 encoding it, decoding it in the destination.
I'm not sure if this process messes things up, but any rows that are expanded lose the indentation of the child rows. I've seen this in the demo exports, but it is not happening in this process.
Hi Jeremy,
We believe that your requirement is to export the pivot table data as a CSV document without the indentation for the child members. If so, our CSV exporting behaves similarly. However, we believe that you may save the document as “Excel”, because we will provide the indentation for the child members while downloading it as a excel document. Thus, you can able to remove the indentation of the row headers using the excelQueryCellInfo event. Please refer the below code example.
Code example:
|
function excelQueryCellInfo(args) { if(args.column.index == 0) { args.style.indent = 0; } } |
Output screenshot:
Meanwhile, we have prepared a sample for your reference.
Sample: https://stackblitz.com/edit/react-ye4qqb-m8vphb?file=index.js,index.html
Moreover, if the above information differs from your requirement, please provide us detailed information about your requirement with screenshot/video if possible, which will help us to investigate further and provide you with details as soon as possible.
Regards,
Angelin Faith Sheeba.