[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Can't open second Excel worksheet in new IE window

Mark

10/16/2007 8:30:00 PM

When I try to display a second Excel worksheet using the code below,
it blanks out my first Excel spreadsheet in IE. Another IE window is
opened, but the first Excel worksheet is displayed in the new IE
window instead of my second Excel worksheet. What am I doing wrong?
I want my first Excel worksheet to open in one IE (Internet Explorer)
window and my second Excel worksheet to open in a new IE window.
Thanks in advance!

=========== CreateReport.aspx.cs ================
String DisplayExcelInNewWindow =
"<script
language=javascript>window.open('DisplayExcelWorkbook.aspx', '_blank',
'width=950, height=750, resizable, toolbar=1');</script>";
Response.Write(DisplayExcelInNewWindow);

============= DisplayExcelWorkbook.aspx ==================
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
FileStream Excel_Stream =
File.OpenRead((string)Session["ExcelFileName"]);
byte[] ExcelWB = new byte[Excel_Stream.Length];
int StreamByte;
int i = -1;
while (true)
{
StreamByte = Excel_Stream.ReadByte();
if (StreamByte == -1)
break;
else
ExcelWB[++i] = (byte)StreamByte;
}
Excel_Stream.Close();
Excel_Stream.Dispose();
File.Delete((string)Session["ExcelFileName"]);
Response.Expires = 0;
Response.Buffer = true;
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(ExcelWB);
Response.Flush();
Response.Close();
}

}