This is a migrated thread and some comments may be shown as answers.

Error Loading Spreadsheet

17 Answers 624 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Trent
Top achievements
Rank 1
Trent asked on 19 Oct 2015, 03:40 PM
I am trying to test the functionality of Spreadsheet using the example at http://demos.telerik.com/aspnet-ajax/spreadsheet/examples/overview/defaultvb.aspx?show-source=true.

I am using Telerik version 2015.3.930.45 in vb.net.

This is pretty simple code and I am receiving the following error.  What am I missing?

-----------------------
Object reference not set to an instance of an object. 
  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.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 
 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 
[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.SpreadsheetDocumentProvider.GetSheets() +72
   Telerik.Web.UI.RadSpreadsheet.PerformSelect() +110
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +30
   Telerik.Web.UI.RadSpreadsheet.EnsureDataBound() +98
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
   Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e) +36
   Telerik.Web.UI.RadSpreadsheet.OnPreRender(EventArgs e) +79
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Control.PreRenderRecursiveInternal() +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974
------------------------------

Code snippets
aspx
   
<div>
    <telerik:RadSpreadsheet runat="server" ID="rssTest"></telerik:RadSpreadsheet>
</div>


aspx.vb
   
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim provider As SpreadsheetDocumentProvider<br>       
Dim path As String = Server.MapPath("~/App_Data/20150530_C09_Schedule.xlsx")
provider = New SpreadsheetDocumentProvider(path)
rssTest.Provider = provider
End Sub

17 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 20 Oct 2015, 05:46 AM
Hi,

There are two possible reasons for the exception. The first is that you haven't included the Telerik Document Processing Library dlls into your project. The SpreadsheetDocumentProvider relies on these dll-s, as described in the following article:
http://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/data-binding/providers/using-a-data-provider

The dlls you need to add into your project are listed here:
http://docs.telerik.com/devtools/aspnet-ajax/controls/spreadprocessing/getting-started

If you already have added the dlls and the exception is still thrown, the other possible issue might be that the file cannot be read for some reason. If this is the case, please send us the file so that we may inspect what could be the problematic data.

Regards,
Bozhidar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Trent
Top achievements
Rank 1
answered on 20 Oct 2015, 12:29 PM

Yes, I have the DLLs you referenced.  See Screenshot_1.

I created a new spreadsheet and only add "1" to cell A1 and saved.  

I changed my Page_Init to use one line like your example so it looks like this.

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init            rssTest.Provider = New SpreadsheetDocumentProvider(Server.MapPath("~/App_Data/SpreadsheetTest.xlsx"))   End Sub

Same result.  I am attaching a screenshot of the spreadsheet.  How do I send the file?

0
Trent
Top achievements
Rank 1
answered on 20 Oct 2015, 12:34 PM

Code formatter fart.​

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init      rssTest.Provider = New SpreadsheetDocumentProvider(Server.MapPath("~/App_Data/SpreadsheetTest.xlsx"))
End Sub

0
Bozhidar
Telerik team
answered on 20 Oct 2015, 01:31 PM
Hi,

You cannot send attachments in forum threads. Please open a support ticket and attach the sample excel file there, so that we can inspect it on our end. Once we find the reason for the issue, we will post it in this thread.

Regards,
Bozhidar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Trent
Top achievements
Rank 1
answered on 26 Oct 2015, 07:22 PM
Sorry, turns out that I did not have the newest DLLs referenced.  Works fine now.  Thanks for your help.
0
Nilesh
Top achievements
Rank 1
answered on 04 Apr 2016, 02:02 PM

while Updating my telerik dll from 2015 to 2016 version. The SpreadSheet funcationality not working.

Please help me out in this.

 

Object reference not set to an instance of an object.

 

[NullReferenceException: Object reference not set to an instance of an object.] Telerik.Web.UI.SpreadsheetDocumentProvider.GetSheets() +30 Telerik.Web.UI.RadSpreadsheet.PerformSelect() +58 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74 Telerik.Web.UI.RadSpreadsheet.EnsureDataBound() +53 Telerik.Web.UI.RadSpreadsheet.OnPreRender(EventArgs e) +27 System.Web.UI.Control.PreRenderRecursiveInternal() +88 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +883

0
Rodrigo
Top achievements
Rank 1
answered on 11 May 2016, 06:41 PM

Hi Trent,

Which version of the dlls you got, I´m facing the same trouble.

thanks.

0
Bozhidar
Telerik team
answered on 12 May 2016, 06:22 AM
Hello,

This exception can happen if the Excel file is opened by another process at the time you are trying to access it. Try closing the excel file and running the application again.

Regards,
Bozhidar
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Rodrigo
Top achievements
Rank 1
answered on 12 May 2016, 01:59 PM

Bozhidar,

 

Thanks but the file is closed, I'm using the spreadsheet inside a RadMultiPage control, I tried to but the spreadsheet control outside the multipage and it works.

 

Now my doubt is how can I emulate something similar like a RadMultiPage in order to achive the same behavior?

This control just accept .xlsx format?

 

Thanks in advance.

0
Bozhidar
Telerik team
answered on 13 May 2016, 06:55 AM
Hi,

I tried the following confituration with the Spreadsheet inside a MultiPage and it again works as expected:
<telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0">
    <telerik:RadPageView ID="RadPageView1" runat="server">
        <telerik:RadSpreadsheet ID="RadSpreadsheet1" runat="server"></telerik:RadSpreadsheet>
    </telerik:RadPageView>
</telerik:RadMultiPage>

protected void Page_Load(object sender, EventArgs e)
{
    RadSpreadsheet1.Provider = new SpreadsheetDocumentProvider(Server.MapPath("Book1.xlsx"));
}

The Spreadsheet offers several databinding options, which are explained in detail in our online documentation:
http://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/data-binding/providers/using-a-data-provider
http://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/data-binding/providers/custom-database-provider
http://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/data-binding/programmatic-binding

Regards,
Bozhidar
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Yogesh
Top achievements
Rank 1
answered on 27 May 2016, 01:32 PM

Hi,

I tried RadMultiPage  option as well as all other binding option but I am getting below error.

[NullReferenceException: Object reference not set to an instance of an object.] Telerik.Web.UI.SpreadsheetDocumentProvider.GetSheets() +72 Telerik.Web.UI.RadSpreadsheet.PerformSelect() +110 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74 Telerik.Web.UI.RadSpreadsheet.EnsureDataBound() +98 System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22 Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e) +36 Telerik.Web.UI.RadSpreadsheet.OnPreRender(EventArgs e) +80 System.Web.UI.Control.PreRenderRecursiveInternal() +88 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Control.PreRenderRecursiveInternal() +160 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +883

I am using Telerik.Web.Spreadsheet v2016.1.108.45

 

Please advice.

Thanks.

0
Bozhidar
Telerik team
answered on 30 May 2016, 12:59 PM
Hello,

Follow the suggestions from the previous posts in this thread, and if this doesn't help you can open a support ticket and send us a sample project, so that we can take a look at your concrete implementation.

Regards,
Bozhidar
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
keng sheng
Top achievements
Rank 1
answered on 22 Sep 2020, 08:23 AM

I using    <telerik:RadSpreadsheet runat="server" ID="RadSpreadsheet1"   > control in my asp.net project to open an excel file.

The funny thing is sometimes it works but sometimes it doesn't work and throw a very common error which is "Object reference not set to an instance of an object."

 

0
Vessy
Telerik team
answered on 25 Sep 2020, 07:47 AM

Hi keng,

Such error is usually thrown when one of the main libraries needed by the Spreadsheet are not referenced. In case you are deploying the app into Load balanced environment, make sure that the DLLs are referenced in all servers:

https://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/troubleshooting/object-reference-not-set-to-an-instance-of-an-object

Regards,
Vessy
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
keng sheng
Top achievements
Rank 1
answered on 29 Sep 2020, 01:30 AM

Dear Admin,

Thanks for your reply, but the funny things is I use it to open the excel file in the same application, 1 file can open and the other 1 cannot, i check across both file and couldn't find there is any differences between these 2 files.

 

 

0
keng sheng
Top achievements
Rank 1
answered on 29 Sep 2020, 02:19 AM
What i figure out the different is the file size. i got 2 files, 1 is 46kb and 1 is 104kb. Spreadsheet able to open the 46kb but not able to open the 104kb. How to resolve this file size limitation issue?
0
Vessy
Telerik team
answered on 29 Sep 2020, 02:40 PM

Hi Keng,

Can you try the approach from this article and see what the behavior will be?

https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/spreadsheet-load-via-json-and-save-with-postback

Namely:

 var path = Server.MapPath("~/App_Data/spreadsheet.xlsx");
SpreadsheetProvider = new SpreadsheetDocumentProvider(path);
var sheets = SpreadsheetProvider.GetSheets();

Another option is to load the files directly on the client-side, avoiding the server-side operations which are using the DPL library:

https://www.telerik.com/forums/saving-radspreadsheet-freezes-when-amount-of-data-is-big#sNlVtgjHSESswiNOQczynw

Regards,
Vessy
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

Tags
Spreadsheet
Asked by
Trent
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Trent
Top achievements
Rank 1
Nilesh
Top achievements
Rank 1
Rodrigo
Top achievements
Rank 1
Yogesh
Top achievements
Rank 1
keng sheng
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or