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.

Wed Jan 21, 2015 12:58 pm

Hi does anyone know how to open/save an xls right from the browser without a dialog box from IE (open, save, saveas)?


Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets[0];
ws.InsertDataTable(gvTable, true, 1, 1);

wb.SaveToHttpResponse("Sample.xls", Response)

cristtiah
 
Posts: 3
Joined: Wed Jan 21, 2015 12:54 pm

Thu Jan 22, 2015 2:35 am

Hello cristtiah,

Thanks for your inquiry.

This problem is about IE settings. And I found some useful information that might help you, please visit links below:

https://social.technet.microsoft.com/fo ... in-ie-9-10

http://superuser.com/questions/246553/h ... t-explorer
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Fri Jan 23, 2015 2:38 am

Hello cristtiah,

There is another way to meet your requirement, please refer to the code below:
Code: Select all
Workbook wb = new Workbook();
wb.LoadFromFile(@"D:\Document\Sample.xlsx", ExcelVersion.Version2010);
//wb.SaveToHttpResponse(@"D:\Download\4283.xlsx", Response);
MemoryStream ms = new MemoryStream();
wb.SaveToStream(ms,FileFormat.Version2010);
File.WriteAllBytes(@"D:\Download\4283.xlsx", ms.ToArray());
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Mon Jan 26, 2015 2:51 pm

Hi how do i open this to the browser if am saving it to the server?

cristtiah
 
Posts: 3
Joined: Wed Jan 21, 2015 12:54 pm

Tue Jan 27, 2015 1:53 am

Hello cristtiah,

That's impossible.

Because all operations are finished on the server, and the generated file are created on the server too. You can not open the document on the server and display it in the browser.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Tue Jan 27, 2015 12:36 pm

is there a way to save it on the client side and open it through Process.Start?

cristtiah
 
Posts: 3
Joined: Wed Jan 21, 2015 12:54 pm

Wed Jan 28, 2015 2:09 am

Hello cristtiah,

You could only use the following method to save the file to client in Spire.
Code: Select all
Workbook wb = new Workbook();
wb.LoadFromFile(@"D:\Document\Sample.xlsx", ExcelVersion.Version2010);
wb.SaveToHttpResponse(@"D:\Download\Sample.xlsx", Response);

But you cannot open it through "Process.Start" for the security reason.

As I know, you can open files on the client using javascript and there are some helpful links you can refer to:
http://p2p.wrox.com/asp-net-1-0-1-1-bas ... erver.html
http://stackoverflow.com/questions/5115 ... lient-side
http://forums.asp.net/t/1856994.aspx?Op ... P+Net+page
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Thu Jan 29, 2015 8:31 am

Hello cristtiah,

Did you try the solution I provided? How is it going?

Looking forward to your response.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Return to Spire.XLS