This project has moved. For the latest updates, please go here.

Error While loading the excel

May 16, 2016 at 10:31 AM
Hi,
  I have generated one excel from reporting tool but while loading excel from below line is throwing exception.
XLWorkbook Workbook = new XLWorkbook(excelFileName);

{"Object reference not set to an instance of an object."}

at ClosedXML.Excel.XLWorkbook.LoadCells(SharedStringItem[] sharedStrings, Stylesheet s, NumberingFormats numberingFormats, Fills fills, Borders borders, Fonts fonts, Dictionary2 sharedFormulasR1C1, XLWorksheet ws, Dictionary2 styleList, Cell cell, Int32 rowIndex)
at ClosedXML.Excel.XLWorkbook.LoadRows(Stylesheet s, NumberingFormats numberingFormats, Fills fills, Borders borders, Fonts fonts, XLWorksheet ws, SharedStringItem[] sharedStrings, Dictionary2 sharedFormulasR1C1, Dictionary2 styleList, Row row)
at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
at ExcelReq.WebForm1.MergeExcel(String fileName, String location) in c:\users\pprateek\documents\visual studio 2010\Projects\ExcelReq\ExcelReq\WebForm1.aspx.cs:line 25
at ExcelReq.WebForm1.Page_Load(Object sender, EventArgs e) in c:\users\pprateek\documents\visual studio 2010\Projects\ExcelReq\ExcelReq\WebForm1.aspx.cs:line 16
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


please help me to resolve this issue.