I am exporting data from an UltraWebGrid to an excel spreadsheet using ultrawebgridexcelexporter from namespace - Infragistics2.WebUI.UltraWebGrid.ExcelExport.v8.3
It works perfectly in IE6 but never gives you the option to Open in IE7 or IE8.
Here is my code:uwgExportGrid.DataSource = buildExportTable(dtExportedDrivers)uwgExportGrid.DataBind()
Dim filePath As String = Request.PhysicalApplicationPath & "assets\downloads\DriverWorksheetTemplate.xls"Dim docName As String = SessionManager.PolicyInformation.PolicyNumber & " DriverList.xls"Dim dWorkbook As New Infragistics.Excel.Workbook
dWorkbook = Infragistics.Excel.Workbook.Load(filePath)
uwgExcelExport.DownloadName = docNameuwgExcelExport.ExportMode = ExcelExport.ExportMode.InBrowseruwgExcelExport.Export(uwgExportGrid, dWorkbook, 4, 0)
'Clear out objectsuwgExcelExport.Dispose()uwgExcelExport = NothingdWorkbook = Nothing
By works perfectly in IE 6 but not in IE 7 or IE 8, do you mean to say that the worksheet opens inside of the IE 6 browser ... but does not open inside of the IE 7 and IE 8 browser? (does the Download prompt still appear in IE 7 and IE 8?)
Between IE 6 and IE 7, Microsoft changed the default behavior for whether Office documents would open inside of the client's browser. These behaviors (as well as registry edits by which the client machine's configured behavior can be changed) are described in the following two Microsoft KB articles:
"How to configure Internet Explorer to open Office documents in the appropriate Office program instead of inside IE 6"http://support.microsoft.com/kb/162059
"A new window opens when you try to view a 2007 Microsoft Office program document in IE 7 or IE 8"http://support.microsoft.com/kb/927009
Unfortunately (or fortunately if seen from the computer security perspective), even though you may set InBrowser to indicate your preference that the Excel worksheet opens inside of the client's browser window, we cannot force the client's browser window to host Excel. InBrowser only sets a "hint" in the HTTP response header we send back to the client, that opening in the browser window is what we would like. However, the client machine can be configured so as to refuse these requests, and that is the default configuration with IE 7 and later.
See the Export Mode property documentation which explains that if the file extension affiliation we use to cue the browser into automatically launching Excel inside the browser has instead been configured on the client not to do so, then InBrowser will fallback to behaving as if the Export Mode were set to Download.