.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Excel "View in browser" or "Edit in browser": Unexcpected Exception

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :SharePoint

Hey everybody

We are using Sharepoint 2010 (Enterprise), Office web apps is installed.

Powerpoint & Word web apps work (view or edit in browser).
When we click on an excel 2003 file we recieve the open in excel dialog (read-only / edit).

Wen we click on an excel 2007 file we get an unexpected exception.

I used the ULS viewer and the correlation id to retrieve the stack trace below:
System.NullReferenceException: Object reference not set to an instance of an object.  
 at Microsoft.Office.Excel.WebUI.XlViewer.OnInit(EventArgs e)   
 at System.Web.UI.Control.InitRecursive(Control namingContainer)   
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Exception follows on the heels of:
Name=Request (GET:http://bekrbsv313:80/sites/medical/_layouts/xlviewer.aspx?id=/sites/medical/Scrum/Sprint.xlsx&Source=http%3A%2F%2Fbekrbsv313%2Fsites%2Fmedical%2FScrum%2FForms%2FAllItems%2Easpx&DefaultItemOpen=1)

does anybody have a clue?

I'm getting desperate :-)

View Complete Post

More Related Resource Links

Excel 2007/ASP.NET Exception using .Workbooks.Add()

Hi,I am receiving the following exception when using the xlApp.Workbooks.Add() method with ASP.NET and Office 2007.  Server Error in '/ExcelTest' Application. Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space. . To make more memory available, close workbooks or programs you no longer need. . To free disk space, delete files you no longer need from the disk you are saving to. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space.   There is plenty of disk space and memory on the servers. What's really strange is that it works OK when I specify a template with the Add method: .Workbooks.Add(Server.MapPath("~") & "\ReportTemplate.xls")So that's a workaround anyway...Below is a small sample I'm using to try and debug this problem.In a new web project, add a reference to Microsoft Excel 12.0 Object Library, add a button named btnGenerateReport, a label named lblStatus, and a Hyperlink named lnkExcelReport to Default.aspx and paste the

Export to excel giving com Exception.

HI All, I am using following code to export content of my grid to excel sheet. Excel. _Worksheet worksheet = (Excel.Worksheet)excelApp.Sheets.get_Item(1);   int columnIndex = 0;   foreach (DataGridViewColumn col in dg.Columns) {   if (col.Visible) { columnIndex++; worksheet.Cells[1, columnIndex] = col.HeaderText;   //Excel.Range is used to set a style and other format information for a cell in excel. Excel. Range rng = (Excel.Range)worksheet.Cells[1, columnIndex]; } } This works fine when I have small amount of column around 200. Sometime I need to show 900 columns in my gird and when I try to export the context of the grid to excel, I get exception saying "Exception from HRESULT: 0x800A03EC" StackTrace says:    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)    at Microsoft.Office.Interop.Excel.Range.set__Default(Object RowIndex, Object ColumnIndex, Object )    at XYZ.ExportToExcel.Export(DataGridView dg) The exception occurs when the columnIndex value becomes 257. Is there any limit of number of columns and rows that can be exported to excel sheet? If possible, please share the code which will resolve this problem. Thanks in advance    

SharePoint 2010 Excel Service Exception

SharePoint 2010 Excel Service Exception   I created Windows Form Application in Visual Studio 2010. I added Service Reference: http://<SharePoint _Server_Name>/_vti_bin/ExcelService.asmx. The code line: ExcelContract.XLWebService.ArrayOfAnyType returnData =              proxy.GetRangeA1(sessionID, sheetName, nameRange, false, out wsStatus);     throws exception: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/office/excel/server/webservices:GetRangeA1Response. The InnerException message was 'Error in line 1 position 361. Element 'http://schemas.microsoft.com/office/excel/server/webservices:anyType' I have the following app.config: <?xml version="1.0" encoding="utf-8" ?> <configuration>     <system.serviceModel>         <bindings>             <basicHttpBinding>                 <binding name="ExcelServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00"             

Exception has been thrown by the target of an invocation while creating Excel



I'm using .NET3.0 and office 2007.  I got the error while creating excel. When I run the code VS-IDE it is working fine. When I hook-up the code with IIS. I am getting the error "Exception has been thrown by the target of an invocation " . I'm getting the error in InvokeMethod.

Dim obooks As Object = oexcel.Workbooks
            Dim ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-US")
            Dim xlWorkBook As Excel.Workbook = obooks.GetType().InvokeMember("Add", Reflection.BindingFlags.InvokeMethod, Nothing, obooks, Nothing, ci)

            Dim xlWorkSheet As Excel.Worksheet

            Dim FileName As String
            Dim fullpath As String
            Dim spath As String

Can any one help me on out in this.

Thanks in Advance


issues with Microsoft.Office.Interop.Excel in asp.net throwing Exception from HRESULT: 0x800A03EC


i m using Microsoft.Office.Interop.Excel in asp.net for Excel file as anEmail attachment .

i get the data and write to Excel but when i try to save like:

oWB.SaveAs(strCurrentDir +strFile, Microsoft.Office.Interop.Excel.


XlFileFormat.xlWorkbookNormal, null,

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Excel Automation in .Net

Excel Automation is a buzz word in both webapps and winapps. In the programming life (like Mr.Anderson neo) I guess almost every one could have come across this word. For others let me go further in detail. Excel Automation is automating some or all of the process involved in creating or updating excel worsheets.


Every self-respected programmer should include exception handling techniques. Sometimes your application will generate an error. Regardless of who was responsible for this error, the programmer or the user, it is up to the first to include the necessary exception handling techniques to keep his/her program from crashing. The .Net environment provides useful techniques for avoiding disastrous errors such as try-catch statements and user-defined exceptions.

Global Exception Handling with ASP.NET

After your global exception handler has done its work, you'll want to redirect the users of your website to a friendly page that tells them that something has gone wrong, and then provide them with customer support information as well as a link back to your web application's home page.

display data into GridView from excel sheet

I have to display data from excel sheet into my gridview and also I need to figure out a way to store data into excel files from my web page. I am using C# 3.5, VS 2008.

Export SharePoint List to Excel Spreadsheet Programmatically using C#

In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Creating an Excel Spreadsheet programmatically using VB.NET

The Interoperability services make it very easy to work with COM Capable Applications such as Word and Excel. This article reveals using Excel from a managed application. Excel is the spreadsheet component of Microsoft Office 2000. The majority of Excel programmatic functionality is exposed through Automation via the type library Excel9.olb. The intention of this article is to express that a managed application can interrelate with Excel as a COM server.

Create And Run Excel Macro At Runtime in C#

You've been tasked with writing a Windows Form application using the .NET Framework that interacts with Microsoft Excel. If you are new to working with Excel in .NET and are having trouble learning how to format certain cells or cell ranges, then this little tip will come in handy. Rather than scour the internet hoping to find the correct set of constants or method syntax for formatting your spreadsheet, use the built in tools in Excel to write the familiar VBA code for you. Then, you can paste the VBA code generated by Excel into the sample C# code below and run it dynamically at runtime.

Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

Creating Excel file from C#

I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is

SQL Server 2005 Try and Catch Exception Handling

I'm pretty excited to see that there is some real error handling for T-SQL code in SQL Server 2005. It's pretty painful to have your wonderfully architected .NET solution tainted by less-than-VBScript error handling for stored procedures in the database. The big difference being the addition of TRY..CATCH blocks. Let's take a look:

Gridview that exports selected rows to Excel

his seems like a messy workaround, but I ended up using two Gridviews - one to display my data and show my checkboxes, and the other which was invisible amd would eventually end up as my Excel spreadsheet.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend