Free Support Forum - aspose.com

Excel 2007 - Object reference not set to an instance of the object

I'm stumped. I have exploring the use of Aspose Cells for a client. I installed the current version of Aspose.Cells.dll from your site and when I run the a simple test (see below), I receive "Object reference not set to an instance of the object". I have enclosed the workbook in question.

Thoughts?

--------------------------------------------------------------------------------------

private void buttonTest_Click(object sender, EventArgs e)
{
Workbook workbook = new Workbook();
try
{
workbook.Open("C:\\Users\\tobrien\\Desktop\\test.xlsx", FileFormatType.Excel2007Xlsx);
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
cells["A2"].PutValue("Hello World!");
workbook.Save("C:\\Users\\tobrien\\Desktop\\test.xlsx", FileFormatType.Excel2007Xlsx);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

Hi,

Thanks for the template file.

Well, yes, we find the problem, We will attach a fix here soon.

Thanks for being patient!

Hi,

Please try this fix.

After testing , we find some featuers are not supported in the this file when opening Excel 2007 xlsx file. We are doing with them. Thanks for your patience.

Better but, not quite.

I'm able to open the workbook and manipulated it. However, on save, I'm encountering a new defect.

workbook.Save("C:\\Users\\tobrien\\Desktop\\Test\\test-out.xlsx", FileFormatType.Excel2007Xlsx);

results in the following:

  • "worksheet cfRule exception"
  • StackTrace " at Aspose.Cells.OpenXML.᭬.ᮄ(XmlTextWriter ቄ)\r\n at Aspose.Cells.OpenXML.᭬.ቃ(XmlTextWriter ቄ)\r\n at Aspose.Cells.OpenXML.᫰.᫱(Workbook ᚠ, Stream ৆)\r\n at Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType)\r\n at Aspose.Cells.Workbook.Save(String fileName, FileFormatType fileFormatType)\r\n at Test_xlsx.Form1.buttonTest_Click(Object sender, EventArgs e)" string

    Thanks for looking into this for me.

-Tim

Hi,

Please try the attached fix, we repaired the problem. Thanks for being patient!


Karen.huang
Developer
Aspose Nanjing Team
About Us
Contact Us