[HttpPost] [AllowAnonymous] public void ExportToExcel([FromBody]RequestParametersForGrid requestParametersForGrid) { ExcelExport we = new ExcelExport(); string gridModel = requestParametersForGrid.GridModel; //HttpContext.Current.Request.Params["GridModel"]; GridProperties gridProperty = ConvertGridObject(gridModel); gridProperty.Columns.RemoveRange(2, gridProperty.Columns.Count -3); ExcelExport exp = new ExcelExport(); var testList = new List<TestItem>(); for (var i = 2; i < 100; i++ ) testList.Add(new TestItem { ItemId = i, ItemCode = "hoooo" + i, DivisionName = "Hhhhhhh" + i }); exp.Export(gridProperty, testList, "MyTestExport.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron"); } |
<dependentAssembly> <assemblyIdentity name="Syncfusion.EJ" publicKeyToken="3d67ed1f87d44c89"/> <bindingRedirect oldVersion="0.0.0.0-15.1451.0.41" newVersion="15.1451.0.41"/> </dependentAssembly> |
|
Hey,
Attached project with all needed data inside. 'GridModel' (which is passed from Syncfusion) is also hardcoded there.
Usage is pretty simple, just open this link in your browser: http://localhost:57526/list/ExportToExcelGet - Check port, it might be different for you. Download should occur or fail. Authorization is disabled for testing simplicity, but would be nice to know how I could add headers for export post request too.
How to login, post request:
How to use token (You must add header: Authorization: Bearer access_token) :
P.S. As I said, authentication is disabled, you can see that in controller, but after you make this export work I definitely gonna need to make it work with authorization too.
Any solution?
Would be nice to know if you are looking into an issue :)
As I understand you won't provide source code of your DLLs, so I could see whats wrong there? As at the moment, without seeing your DLL code, I have no clue whats wrong and it's simple Web API RESTful application, recreating won't help, there must be some settings missing or something.
M? :)