We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to export grid data without having to save it to a file first

Thread ID:

Created:

Updated:

Platform:

Replies:

141866 Jan 8,2019 10:35 PM UTC Jan 10,2019 11:19 AM UTC React - EJ 2 1
loading
Tags: Grid
Pat Buchanan
Asked On January 8, 2019 10:35 PM UTC

Good afternoon!  We are considering purchasing the product but are currently exploring its capabilities.  One of the items I have not been able to get to work is finding a way to export grid data and have it open immediately, without having to save it to the drive first.  The PDF opening up in the default PDF viewer, and the Excel file opening directly in Excel.

Is this possible?

Pavithra Subramaniyam [Syncfusion]
Replied On January 10, 2019 11:19 AM UTC

Hi Pat, 
 
Thanks for your interest in Syncfusion product. 
 
In Essential JavaScript 2, the PDF can be viewed in browser directly by saving PDF to the Blob and then using the blob data to open the PDF in new tab. In Grid Pdf Export you can get the blob data in the ‘pdfExportComplete’ event. Please refer to the below code example and sample link for more information. 
 
[index.jsx] 
export class Exporting extends SampleBase { 
         
        pdfExpComplete = (args) => { 
            //This event will be triggered when pdf exporting. 
            args.promise.then((e) => { 
                //In this `then` function, we can get blob data through the arguments after promise resolved. 
                var blobURL = URL.createObjectURL(e.blobData); 
                window.open(blobURL); 
            }); 
        }; 
        toolbarClick(args) { 
            switch (args.item.text) { 
                case 'PDF Export': 
                    // pdfExport(pdfExportProperties, isMultipleExport, pdfDoc, isBlob) 
                   // if ‘isBlob’ is set as true then it will return blob data 
                    this.gridInstance.pdfExport(null, null, null, true); 
                    break; 
                 
            } 
        } 
        render() { 
            return (<div className='control-pane'> 
                <div className='control-section'> 
                    <GridComponent dataSource={orderDetails} ref={grid => this.gridInstance = grid} toolbar={this.toolbarOptions} allowPaging={true} allowExcelExport={true} allowPdfExport={true} toolbarClick={this.toolbarClick.bind(this)} pdfExportComplete={this.pdfExpComplete.bind(this)}> 
                        <ColumnsDirective> 
                          .  .  . 
                        </ColumnsDirective> 
                        <Inject services={[Page, Toolbar, ExcelExport, PdfExport, Group]} /> 
                    </GridComponent> 
                </div> 
            </div>); 
        } 
    } 
 
    render(<Exporting />, document.getElementById('sample')); 
 
 
 
For Excel Exporting could you please share the details whether you want to view the file in MS Excel or any web viewer. This information will be helpful for us to provide a better solution as early as possible.  
 
Regards, 
Pavithra S. 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;