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
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];
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.
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.
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 { get; set; } } |
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.
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.
Thanks for your update Ravichandra
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. |
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.
1) Download as many rows as possible then download the second part, the third and so on you can do this by exportDataAsExcel(params) where params are implemented BaseExportParams which has several fields for example you can use only selected.
2) A more convenient way to do this is to create a backend service without using ag-grid API.
Hope You Find This Useful,
Peter