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
close icon

Export failing

Hello,

Trying to implement export, to my WebAPI RESTful backend with your components, but so far no luck.

Syncfusion and your dll files version is: 15.1451.0.41 - Won't upgrade to latest ones at the moment.

Error:

Controller method (GridModel sent from frontEnd is attached in zip file as txt):
        [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");

        }


Added dependentAssembly to web.config
      <dependentAssembly>
        <assemblyIdentity name="Syncfusion.EJ" publicKeyToken="3d67ed1f87d44c89"/>
            <bindingRedirect oldVersion="0.0.0.0-15.1451.0.41" newVersion="15.1451.0.41"/>
       </dependentAssembly>

References added:


Sometimes it won't throw any error but also won't return anything - Download failed. Any ideas?





Attachment: GridModel_381cf8d4.zip

12 Replies

ME Me June 16, 2017 01:01 PM UTC

This is what I get sometimes when there are no errors for the same code:

    1. Request URL:
      http://localhost:57526/list/ExportToExcel
    2. Request Method:
      POST
    3. Status Code:
      200 OK
    4. Remote Address:
      [::1]:57526
    5. Referrer Policy:
      no-referrer-when-downgrade
  1. Response Headersview parsed
    1. HTTP/1.1 200 OK Cache-Control: private Transfer-Encoding: chunked Content-Type: Application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Server: Microsoft-IIS/10.0 Content-Disposition: attachment; filename=MyTestExport.xlsx; X-AspNet-Version: 4.0.30319 X-SourceFiles: =?UTF-8?B?RTpcR1BcR1BXZWJcR1BXZWIuV2ViQVBJXGxpc3RcRXhwb3J0VG9FeGNlbA==?= X-Powered-By: ASP.NET Date: Fri, 16 Jun 2017 12:59:41 GMT
  2. Request Headersview parsed
    1. POST /list/ExportToExcel HTTP/1.1 Host: localhost:57526 Connection: keep-alive Content-Length: 13109 Cache-Control: max-age=0 Origin: http://localhost:3000 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 Content-Type: application/x-www-form-urlencoded Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Referer: http://localhost:3000/home Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.8,lt;q=0.6




JK Jayaprakash Kamaraj Syncfusion Team June 19, 2017 08:29 AM UTC

Hi Customer, 

Thank you for contacting Syncfusion support. 

The mentioned issue is occurred, due to when the columns bound to the Grid are not defined in the Grid dataSource. We have already discussed the same issue in following knowledge base document.  


Regards, 

Jayaprakash K. 



ME Me June 19, 2017 03:20 PM UTC

Already solved this with that page, but the issue remains - no download is completed. I don't get any errors but none of internet browsers can complete download. I always get the same error: Download failed / server error, thought filename is received but not file. Any idea?


JK Jayaprakash Kamaraj Syncfusion Team June 20, 2017 12:38 PM UTC

Hi Customer, 

We have prepared a sample based on your requirement but we were unable to reproduce the issue at our end. please share the details about issue and we will provide the prompt solution to you. 
 
1.       Grid rendering full code example both client and server. 
2.       Share the video to show the issue. 
3.       Browser details. 
4.       If possible, provide an issue reproducing sample or hosted link or replicate the issue in the attached sample. 

Regards, 

Jayaprakash K. 
 



ME Me June 21, 2017 10:56 AM UTC

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.



ME Me June 21, 2017 10:56 AM UTC

Trying to add sample project once again..


Attachment: SyncfusionWebAPISample_a6b0aae1.rar


ME Me June 27, 2017 12:04 PM UTC

Any solution?



ME Me June 29, 2017 07:18 AM UTC

Would be nice to know if you are looking into an issue :)



JK Jayaprakash Kamaraj Syncfusion Team June 29, 2017 03:30 PM UTC

Hi Customer, 

We are sorry for the delay. 

We have analysed your sample and also we have checked your sample with text file downloading (without using Syncfusion Grid Control) that also have the same error (failed-network error). So, we suspect that the issue in your application. So, we suggest you to create a new application and then use grid excel export in that application. After creating new application, If you  face any problem please get back to us. 

Regards, 

Jayaprakash K. 



ME Me June 30, 2017 06:48 AM UTC

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.



ME Me July 4, 2017 05:23 AM UTC

M? :)



FS Farveen Sulthana Thameeztheen Basha Syncfusion Team July 4, 2017 04:12 PM UTC

Hi Customer, 

We cannot  provide the source code of the DLLs. While checking your application, the issue occurs on normal file downloading  i.e ( without using syncfusion controls)itself. Hence we asked you to create an another application. By resolving that issue, excel file download will work. So please check with your application and get back to us if you need any further assistance. 

Regards, 

Farveen sulthana T 


Loader.
Live Chat Icon For mobile
Up arrow icon