Spire.DataExport for .NET is a 100% pure data .NET library suit for exporting data into MS Word, Excel, RTF, Access, PDF, XPS, HTML, XML, Text, CSV, DBF, SYLK, SQL Script, DIF, Clipboard, etc.

Thu Oct 06, 2016 11:07 am

A recent chrome update has knocked out the ability to use your tool to export a CSV file.

https://productforums.google.com/forum/ ... e/category

The fix in this post suggests setting the Content-Length on the header, the only problem is I don't have access to this from your tool?

locTXTExport.SaveToHttpResponse(locFilename, Response, Spire.DataExport.Common.SaveType.Attachment)

Any solution would be greatfully recevied

ascotford
 
Posts: 12
Joined: Wed Sep 18, 2013 3:34 pm

Fri Oct 07, 2016 2:58 am

Dear ascotford,

Thanks for your inquiry.
I have noticed the issue and posted it to our Dev team. We will inform you once there is any progress.
Sorry for inconvnience caused.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Sun Oct 09, 2016 8:32 am

Dear ascotford,

We first suggest you to save the file to stream, and then operate it according to your requirement.
Code: Select all
            var stream = new MemoryStream();
            CSVExport.SaveToStream(stream);


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Oct 13, 2016 9:16 am

Dear ascotford,

Did you use the solution I suggest ? Has your issue been resolved ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Oct 18, 2016 8:52 am

Hi,

That solution sounds like it should work, I will try and get around to implementing it this week and will let you know the outcome.

Kind Regards,

Andrew Scotford

ascotford
 
Posts: 12
Joined: Wed Sep 18, 2013 3:34 pm

Tue Oct 25, 2016 8:28 am

Hello ascotford,

I am facing the same problem as yours. I tried the proposed solution, it worked locally however it is still not working when deployed to the production server.

Were you able to fix this issue?

Please advise.
Thank you.

lbassil
 
Posts: 4
Joined: Sat Oct 15, 2011 11:27 pm

Wed Oct 26, 2016 6:26 am

Hi lbassil,

Thanks for posting.
Could you please describe the issue on production serve in detail ? So that we can understand it clearly and then investigate it.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Oct 26, 2016 11:11 am

Hello Betsy,

Thank you for replying back. My problem is the same as described. We are using a function to export a gridview to excel using the Spire.DataExport tool and writing the result to the response using SaveToHttpResponse.

I have tried the suggestion you proposed in your earlier reply which is adding "Content-Length" to the header by saving the output first to a memory stream. When I use Chrome to run my application and try to export to excel the grid, I am getting a Network Failed error and I am not able to download the excel file. Locally I am no more facing this problem after adding the "Content-Length" to the header, I have windows 10 installed on my PC.

However when I deploy the application to the production server running Windows Server 2008 R2 and IIS 7, I am getting the "Failed - Network Error" in Chrome Version 54.0.2840.71 (which is the last current version of Chrome).

I need to solve this issue urgently as users are no more able to export the listing grids to excel.

Thank you in advance,
Regards.

lbassil
 
Posts: 4
Joined: Sat Oct 15, 2011 11:27 pm

Thu Oct 27, 2016 8:56 am

Hi lbassil,

Thanks for your information.
I have tested the scenario on Windows Server 2012 R2 and IIS 7, use Chrome Version 54.0.2840.71 and Spire.DataExport for .NET (Hot Fix) Version:3.5.86. But didn't encouter any issue.
Here is my testing code:
Code: Select all
            Spire.DataExport.XLS.CellExport cellExport = new Spire.DataExport.XLS.CellExport();
            Spire.DataExport.XLS.WorkSheet worksheet1 = new Spire.DataExport.XLS.WorkSheet();
            worksheet1.DataSource = Spire.DataExport.Common.ExportSource.DataTable;
            worksheet1.DataTable = dt;
            worksheet1.StartDataCol = ((System.Byte)(0));
            cellExport.Sheets.Add(worksheet1);
            cellExport.ActionAfterExport = Spire.DataExport.Common.ActionType.OpenView;
            using (MemoryStream stream = new MemoryStream())
            {
                cellExport.SaveToStream(stream);
                ViewFile(stream);
            }
        }
        private void ViewFile(Stream fs)
        {           
            Response.Clear();
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment; filename=filename.xls");
            Response.AddHeader("Content-Length", fs.Length.ToString());         
            fs.CopyTo(Response.OutputStream);
            Response.OutputStream.Flush();
            Response.OutputStream.Close();
        }


Which Spire.DataExport version you were using ? And what is your code ? Also, we will build Windows Server 2008 R2 to test it.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Oct 27, 2016 11:46 am

Hello Betsy,

Thank you very much for your prompt response. Your code worked, I copied it and used the exact same code and it worked. I had almost the same code but it seems I was missing something which was causing the error.

Many thanks again and keep up the good work.
Best Regards.
Layale.

lbassil
 
Posts: 4
Joined: Sat Oct 15, 2011 11:27 pm

Fri Oct 28, 2016 1:21 am

Hi Layale,

Thanks for your feedback.
Welcome to write to us for further question. We will be happy to help you.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Nov 01, 2016 1:27 pm

I have implemented the fix and this works perfectly for me, thanks for your help in this matter

ascotford
 
Posts: 12
Joined: Wed Sep 18, 2013 3:34 pm

Wed Nov 02, 2016 1:32 am

Hi ascotford,

Thanks for your feedback.
Please feel free to contact us if there is any question.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.DataExport