G
Guest
I'm trying to stream an Excel file to IE from an ASP.NET page (VB.NET 1.1).
I've been searching the web for a couple of days and found many different but
similar methods, tried everything I've found and none of it works for me. I
consistently get the following two error messages, in this order:
"Could not open '<MY URL>'."
"Microsoft Office Excel cannot access the file '<MY URL>'. There are several
possible reasons: The file name or path does not exist. The file is being
used by another program. The workbook you are trying to save has the same
name as a currently open workbook."
The code I am currently using is as follows ...
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("content-length", Convert.ToString(Bytes.Length))
Response.OutputStream.Write(Bytes, 0, Convert.ToInt32(Bytes.Length))
Response.Flush()
Bytes is a Byte array containing the file. Ultimately I want to be using a
Byte array generated by Report Services, but have also tried reading an Excel
file from the file system into a Byte array to rule out Report Services as
the source of my grief.
This code (with ContentType="application/pdf") works fine when streaming a
PDF, but I just can't get it to work with Excel.
Can anyone help please?
Many thanks in advance,
Rob
P.S. Please let me know if this would be better posted elsewhere.
I've been searching the web for a couple of days and found many different but
similar methods, tried everything I've found and none of it works for me. I
consistently get the following two error messages, in this order:
"Could not open '<MY URL>'."
"Microsoft Office Excel cannot access the file '<MY URL>'. There are several
possible reasons: The file name or path does not exist. The file is being
used by another program. The workbook you are trying to save has the same
name as a currently open workbook."
The code I am currently using is as follows ...
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("content-length", Convert.ToString(Bytes.Length))
Response.OutputStream.Write(Bytes, 0, Convert.ToInt32(Bytes.Length))
Response.Flush()
Bytes is a Byte array containing the file. Ultimately I want to be using a
Byte array generated by Report Services, but have also tried reading an Excel
file from the file system into a Byte array to rule out Report Services as
the source of my grief.
This code (with ContentType="application/pdf") works fine when streaming a
PDF, but I just can't get it to work with Excel.
Can anyone help please?
Many thanks in advance,
Rob
P.S. Please let me know if this would be better posted elsewhere.