Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem opening Excel from Response.WriteFile output stream

Reply
Thread Tools

Problem opening Excel from Response.WriteFile output stream

 
 
Jonathan
Guest
Posts: n/a
 
      09-20-2006
Hi everyone,
I'm having an issue with my Excel streaming. I run my procedure and if
I "Save As" when the dialog opens and then open the file I generate,
it's perfect. Also, if I choose "Open" when Excel is already running,
it's perfect.
If I click "Open" but Excel isn't running, I get an error message:
'C:\...snip...\Temporary Internet
Files\Content.IE5\CPW1639P\export090220061230 [1].xls' could not be
found. Check the spelling of the file name, and verify that the
location is correct.
If you are trying to open the file from your list of most recently used
files on the File menu, make sure that the file has not been renamed,
moved, or deleted.

The file is not, in fact, there in the folder.
I tried generating a more unique filename so that it wouldn't keep
using export.xls and using the [1] all the time, but that did nothing.

My output stream is constructed with:
Response.Cache.SetExpires(DateTime.Now.AddSeconds( 1));
Response.Charset = "";
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
string datetimeid = DateTime.Now.ToString("MMddyyyyHHmm");
Response.AppendHeader("Content-Disposition", "attachment;
filename=export" + datetimeid + " .xls");
Response.WriteFile(fname); // fname is the file constructed earlier in
the process
Response.Flush();
Response.End();

So why can I save the file and open it up, but I can't open it up right
from the Open/Save As dialog?

Thanks!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with opening Excel after opening Excel inside Microsoft Internet Controls fniles ASP General 0 04-26-2009 09:39 PM
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
Conversion from Input Stream to Output Stream Kashif Ur Rehman Java 2 05-17-2007 07:50 PM
OLE & Excel - Opening causes Excel.exe to hang around TimmyD Perl Misc 0 04-21-2005 07:20 PM
Doing readline in a thread from a popen4('rsync ...') stream blocks when the stream ends. Rasmusson, Lars Python 1 04-30-2004 08:10 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57