Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Jan 27, 2014 9:45 pm

Hi,

I encontered a strange behaviour in "SaveToHttpResponse" with current Firefox-Browser and also Opera-Browser.

At first my enviroment:
Spire.xls Version 7.3.0.7040
Webserver: IIS 8
Asp.net 4.5
Protokoll: SSL


My problem in Firefox and Opera:

I have an Excel file as a template which is definetly a Excel 2007 file. And my code goes like this


---------------------------
workbook.LoadFromFile(aFile, ExcelVersion.Version2007)

....
Do some stuff in Excel
....

workbook.SaveToHttpResponse("AnExcelFile.xlsx", Response)
Response.End()
---------------------------

Although I set "ExcelVersion.Version2007" and the filename with a proper extension "AnExcelFile.xlsx" the "SaveToHttpResponse" changes the filename to "AnExcelFile.xlsx.xls" It adds the extension ".xls". But only in Firefox- and Opera-Browser.

The Firefox- and Opera-Browser suppose, that the downloaded Excel is an old Excel Version (97to2003). The browsers throw a warning.

But!
In IE it all works fine. IE correctly detecs a Excel 2007 file and in IE it works like a charm.

Any clues about the problem in the different browsers? I only tested the current versions of IE, Firefox and Opera.

Best regards
Oliver

InfoCon
 
Posts: 9
Joined: Fri Aug 20, 2010 8:34 am

Tue Jan 28, 2014 9:14 am

Hello Oliver,

Thanks for your feedback.
Please try the following method.
Code: Select all
 
Workbook book = new Workbook();
//...
using (MemoryStream stream = new MemoryStream())
{
   book.SaveToStream(stream);
   byte[] buffer = stream.ToArray();
   Response.Clear();
   Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
   Response.AddHeader("Content-Disposition", "attachment;filename=Result.xlsx");
   Response.OutputStream.Write(buffer, 0, buffer.Length);
}

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Feb 03, 2014 9:43 am

Hello InfoCon,

Did you test the method provided by Gary? Has the issue been resolved? Could you please give us some feedback if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Wed Feb 12, 2014 10:16 am

Thank you for your answer.

Sorry for delay, I've been out of office a longer time. I'll try the solution and will get right back to you with the results.

Best regards
Oliver

InfoCon
 
Posts: 9
Joined: Fri Aug 20, 2010 8:34 am

Wed Feb 12, 2014 10:31 am

Good job :-)

Fix approved for Firefox and Opera.

Thank you very much. Will "SaveToHttpResponse" be fixed in later releases concerning this issue?

Best regards
Oliver

InfoCon
 
Posts: 9
Joined: Fri Aug 20, 2010 8:34 am

Thu Feb 13, 2014 1:21 am

Thanks for your feedback. It would be fixed in later release.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.XLS