Free Support Forum - aspose.com

Object reference not set - during save

Hi. I’ve got an application running on our web site that’s been working fine for several months now. It works fine when I call it from my own machine, and I think we have a couple of clients that use it without any problems. I had one client call me today, though, and tell me that she was getting an error when she tried to generate a spreadsheet. She’s getting an “object reference not set” error in the Excel.Save method call. I’m at a loss as to why she’s having a problem, and I’m not. We’re both logging in to the web server with the same credentials, so the only real difference I can see might be in her browser settings. We’re using Aspose.Excel 1.5. If you have any idea what might be causing this, please let me know. Thanks!

Here’s the stack trace, if that helps:


[NullReferenceException: Object reference not set to an instance of an object.]
Aspose.Excel.Worksheets.WriteData(String resultSpreadsheet, SaveType saveType, FileFormatType fileFormatType, HttpResponse response) +157

[Exception: Erros in Excel Save method]
Aspose.Excel.Worksheets.WriteData(String resultSpreadsheet, SaveType saveType, FileFormatType fileFormatType, HttpResponse response) +1241
Aspose.Excel.Excel.Save(String resultSpreadsheet, FileFormatType fileFormatType) +379
NMS.SurveyExcel.SaveWorkbook() +10
ASP.ivs_2003t_wbh2347_aspx.Page_Load(Object sender, EventArgs e) in d:\inetpub\wwwroot\surveys\warner \ivs_2003t_wbh2347.aspx:79
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Dear Andy,

I have to ask the following questions to solve your problem.

Which edition are you using, basic, standard, professional or corporate?
Does your application require user to input some data to generate the result file? And would your app open a designer file?

Could you send the related code to me? Thus I can see what may cause this problem.

Thanks.


  • We’re using the standard edition.

    - The user really doesn’t input anything. They generate the file from the same data regardless of where they’re running it.

    - The app does not open a designer file.

    - This is the line of code where I’m crashing:

    this.Save(strPhysicalPath, FileFormatType.Default);

    I just have an object that’s inheriting from the Excel object. Filling up the spreadsheet with data seems to work OK. It fails when it’s trying to save.

Dear Andy,

this.Save(strPhysicalPath, FileFormatType.Default);

Is strPhysicalPath same when different users are accessing your web page?


When several users concurrently access your web page, if your app concurrently saves result files in the same path with same file name. This problem may occur.

I haven’t heard back from the client who originally had this problem, so I’m hoping it was just a fluke and it’s working OK for them now. Thanks for your help.