We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Export to Excel from .NET Data Table - need to open in a new Window

When this report opens in either the browser or Excel it opens in the same window as the web application that it was running from. There is no back button available and no way to get back to the orginial web application.

How can I get this workbook to open in a new window?

DataTable dataTable = (DataTable)Session["SearchResults"];

Aspose.Cells.License license = new Aspose.Cells.License();


//Request.ApplicationPath as it returns a "/" when at the root but not when in a vitural directory

string sPath = Server.MapPath(HttpContext.Current.Request.ApplicationPath);

if (sPath.Substring(sPath.Length -1,1) != "\\")

sPath = sPath + "\\";

string sFile = sPath + "GamReporting.xls";

Workbook workbook = new Workbook();


Worksheet sheet = workbook.Worksheets[0];

int rc;

rc = sheet.Cells.ImportDataView(dataTable.DefaultView, true, 0, 0, true);

workbook.Save("GAMReporting.xls" + System.DateTime.Now.ToString(), FileFormatType.Default, SaveType.OpenInBrowser, Response);


Thanks for considering Aspose.

Please change your last line of code to:

workbook.Save("GAMReporting.xls" + System.DateTime.Now.ToString(), FileFormatType.Default, SaveType.OpenInExcel, Response);

Thank you.

I get the same result either way. Is there a way to force it into a new window?