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. Image for the cookie policy date

Unable to read Angular Grid Excel Export Blob to XlsIo

Hello Team,

I am trying to read Excel Blob provided by Angular Grid Control which not able to open by xlsio. Sample Excel File Attached. 


Angular Export Code:

exportToExcel

let leftGridExport: Promise<any> = this.leftGrid.treegrid.excelExport(
                appendExcelExportProperties,
                true
            );
            leftGridExport.then((leftGridData: any) => {
                const rightGridExport: Promise<any> = this.rightGrid.treegrid.excelExport(appendExcelExportProperties, false, leftGridData, true);
                rightGridExport.then((rightGridData: any) => {

                });
            })

exportComplete

 args.promise.then((e) => {
//sending request to api
            this.pageService.exportToDoubleTreeGridExcel({}, e.blobData);
});


API Code

string path = Path.Combine(serverTempFolder, DateTime.Now.Ticks.ToString() + ".XLS");

            using (FileStream outputFileStream = new FileStream(path, FileMode.Create))

            {

                fileStream.CopyTo(outputFileStream);

                outputFileStream.Close();

                outputFileStream.Dispose();

            }


            IApplication app = excelEngine.Excel;

            //app.DefaultVersion = ExcelVersion.Excel97to2003;

            IWorkbook workbook = app.Workbooks.Open(path, ExcelOpenType.Automatic);

            IWorksheet worksheet = workbook.Worksheets[0];




Attachment: 638035282594101955_8eb0cb57.zip

6 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 9, 2022 08:22 AM

When attempting to open the shared Excel document with Syncfusion XlsIO, an ArgumentOutOfRange exception is thrown. This is being validated currently, and the validation details will be shared on November 11, 2022.



NG Nagendra Gupta November 9, 2022 09:05 AM

Hi,


Thanks for your update, I don't required the validation detail, just I want to export excel from grid to server side. Because SF is is not providing side to side excel for two tree grid. 


Give me the solution how to send exported excel by angular grid directly to the server. 



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 11, 2022 10:21 AM

Regarding Give me the solution how to send exported excel by angular grid directly to the server.


Currently we don’t have support for your requirement. We have added this requirement in our feature list “Need to provide Serverside Exporting support in TreeGrid” . This will be promised to include in our any of the upcoming releases. Please cast your vote on this feature based on the customer demand we will prioritize the features in our upcoming road map.


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 

https://www.syncfusion.com/feedback/26486/need-to-provide-serverside-exporting-support-in-treegrid


Until then we suggest you refer to use the serverExcelExport method of the Grid.  Using this Grid serverExcelExport we can Export only plain Grid on Excel Exporting.  As of now, we couldn’t Export based on Hierarchical structure. After providing support the feature mentioned above in TreeGrid, it will export as like Hierarchy structure.


Refer to the code below:-

App.component.html

<ejs-treegrid [dataSource]='data' #treegrid height='220' (toolbarClick)='toolbarClick($event)' [allowPaging]='true' [allowExcelExport]='true' [treeColumnIndex]='1'  childMapping='subtasks' [toolbar]='toolbarOptions'>

        <e-columns>

<e-column field='taskID' headerText='Task ID' textAlign='Right' width=90></e-column>

             .    .    .

        </e-columns>

</ejs-treegrid>

App.component.ts

export class AppComponent implements OnInit {

public data: Object[];

public pager: Object;

         @ViewChild('treegrid')

public treeGridObj: TreeGridComponent;

public toolbarOptions: ToolbarItems[];

         ngOnInit(): void {

             .   .  .

this.toolbarOptions = ['ExcelExport'];

         }

toolbarClick(args: Object): void {

if (args['item'].text === 'Excel Export') {

this.treeGridObj.grid.serverExcelExport('Home/ExcelExport');

             }

         }

     }

 

HomeController:-

 

  public ActionResult ExcelExport([FromForm] string gridModel)

        {

            GridExcelExport exp = new GridExcelExport();

            Grid gridProperty = ConvertGridObject(gridModel);

return exp.ExcelExport<OrdersDetails>(gridProperty, orddata);

        }

        private Grid ConvertGridObject(string gridProperty)

        {

            Grid GridModel = (Grid)Newtonsoft.Json.JsonConvert.DeserializeObject(gridProperty, typeof(Grid));

            GridColumnModel cols = (GridColumnModel)Newtonsoft.Json.JsonConvert.DeserializeObject(gridProperty, typeof(GridColumnModel));

            GridModel.Columns = cols.columns;

return GridModel;

        }

        public class GridColumnModel

        {

public List<GridColumn> columns { getset; }

        }


Documentation link:- https://ej2.syncfusion.com/angular/documentation/grid/excel-export/exporting-grid-in-server/#server-configuration

And, requesting you to confirm if you are using Grid or TreeGrid in your application.


Regarding the validation for Excel:


We have confirmed the issue as
Argument Out of Range Exception is thrown while parsing worksheet with outline level value greater than 8 and logged a defect report. The fix will be included in the weekly NuGet release scheduled for
November 22, 2022
and the status of the fix can be tracked using the feedback link provided below.


https://www.syncfusion.com/feedback/39034/argument-out-of-range-exception-is-thrown-while-worksheet-outline-level-value-is


Disclaimer:
Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.



NG Nagendra Gupta November 14, 2022 02:21 AM

Thanks for your update Ravichandra


  1. serverExcelExport  : Is this method provided levels of row in exported grid
  2. Is this method supports multiple treegrid export




KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 22, 2022 07:39 AM

Nagendra, we have now included the fix to resolve the issue Argument Out of Range Exception is thrown while parsing worksheet with outline level value greater than 8 in our weekly NuGet release version 20.3.0.58. Kindly upgrade to this latest version and let us know if the issue is resolved.


Latest NuGet Package: https://www.nuget.org/packages/Syncfusion.XlsIO.AspNet.Mvc5/20.3.0.58


Also, please find the response for your queries below.


Query

Response

serverExcelExport  : Is this method provided levels of row in exported grid

 

By using ServerExcelExport method we can perform Server end Exporting in TreeGrid (we can Export only plain Grid on Excel Exporting). As of now, we couldn’t Export based on Hierarchical structure(like levels) as mentioned in the previous update.

Is this method supports multiple treegrid export

 

We have forwarded this query to the concerned team for verification. We will share the details on November 25th, 2022.




KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 24, 2022 11:24 AM

Nagendra, Regarding the query: Is this method supports multiple treegrid export


We have considered this as a feature request Need to Provide support for Multiple Grid export at server side and added it to our feature request database. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. And this feature will be included in any of our upcoming releases.


You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.

Feedback: https://www.syncfusion.com/feedback/39343/need-to-provide-support-for-mutiple-grid-export-at-server-side


Loader.
Live Chat Icon For mobile
Up arrow icon