Free Support Forum - aspose.com

Errors in Excel Save Method

Dear Support,

I’m getting Errors in Excel Save Method.

I have Excel template that has Data Validation and wonder if that’s causing problems when saving with Developer Professional version.

If that’s why I’m getting error message, what do you recomment? Will Enterprise version solve my problem? If it will, I would like to upgrade it. (BTW, I purchased it yesterday.)

Here is my stack trace:

[NullReferenceException: Object reference not set to an instance of an object.]
Aspose.Excel.Record.?.?(String ?) +30
Aspose.Excel.Record.?.?(Validation ?, Int32 ?) +73
Aspose.Excel.Record.?.?(Validation ?) +435
Aspose.Excel.Worksheet.?(? ?) +7779
Aspose.Excel.Worksheets.?(? ?) +502
Aspose.Excel.Record.?.?(? ?, ? ?, Worksheets ?) +834
Aspose.Excel.Worksheets.?(String ?, SaveType ?, FileFormatType ?, HttpResponse ?) +774

[Exception: Errors in Excel Save method:0]
Aspose.Excel.Worksheets.?(UInt32 ?, Exception ?) +365
Aspose.Excel.Worksheets.?(String ?, SaveType ?, FileFormatType ?, HttpResponse ?) +1007
Aspose.Excel.Excel.Save(String fileName, SaveType saveType, FileFormatType fileFormatType, HttpResponse response) +340
BackOffice.Incentives.ReviewIncentive.btnVendorFormExcel_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\backoffice\incentives\reviewincentive.aspx.cs:361
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292


Please advise.
Thank you.

I found out that it wasn't the Data Validation.

I'm not sure what's causing this problem. Here I'm attaching our Excel template and the code. Just a basic opening and saving this template causes problem.

string excelTemplate = Server.MapPath("VendorProfileFormTemplate.xls");
Excel excel = new Excel();
excel.Open(excelTemplate);

Worksheet sheet = excel.Worksheets["Vendor"];
Cells cells = sheet.Cells;

excel.Save("VRForm.xls", SaveType.OpenInExcel, FileFormatType.Default, Response);

Please help.
Thank you.

Which version are you using? I tested but didn’t find the problem. Please download and try the latest version at http://www.aspose.com/Downloads/Aspose.Excel/3.2.4.0/Default.aspx.