Free Support Forum - aspose.com

Open/save popup shows twice

When I want to export a report to Excel, the popup which asks ‘Open’, ‘Save’, ‘Cancel’ shows twice before opening Excel.

The following function is used.

public void StreamToBrowser(string fileName)

{

fileName += ExcelCreator.excelExt;

fileName=fileName.Replace("?",“aa”);

fileName=fileName.Replace("?",“AA”);

fileName=fileName.Replace("?",“ae”);

fileName=fileName.Replace("?",“AE”);

fileName=fileName.Replace("?",“oe”);

fileName=fileName.Replace("?",“OE”);

byte[] bFileName =null;

bFileName = Encoding.Default.GetBytes(fileName);

fileName = Encoding.ASCII.GetString(bFileName);

HttpContext.Current.Response.ContentType = “application/vnd.ms-excel”;

HttpContext.Current.Response.AddHeader(“content-disposition”, “attachment;filename=” + fileName + “”);

currentSheet.PageSetup.Orientation=PageOrientationType.Landscape;

excelApplication.Save(fileName, SaveType.OpenInBrowser, FileFormatType.Excel97, HttpContext.Current.Response);

}

Please remove these two line of code:

HttpContext.Current.Response.ContentType = “application/vnd.ms-excel”;

HttpContext.Current.Response.AddHeader(“content-disposition”, “attachment;filename=” + fileName + “”);

When you use OpenInBrowser option, Aspose.Excel would set the header as following:

HttpContext.Current.Response.ContentType = “application/vnd.ms-excel”;

HttpContext.Current.Response.AddHeader(“content-disposition”, “inline;filename=” + fileName + “”);


If the windows still show twice after removing these code, please install all windows and IE patches. It will solve this issue.