We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Cells fails to load Excel 2010 file

Hi,

I am trying to load an xlsx file created using Excel 2010.

When I try and instantiate a workbook (see line highlighted in yellow below), I get an "Object reference not set to an instance of an object" exception.

The stack trace seems to contain a lot of weird characters, so clearly something is going wrong:

--------------Stack Trace---------------------

at ٱ.♕.♅(XmlTextReader ൬)\r\n at ٱ.♕.♜(XmlTextReader ก)\r\n at ٱ.䱜.:open_umbrella:()\r\n at ٱ.䱜.࣫()\r\n at ٱ.䱜.䱝(Workbook ෙ, Stream ԁ, LoadDataOption ੘)\r\n at Aspose.Cells.Workbook.Ӿ(Stream ԁ, LoadOptions Ԁ)\r\n at Aspose.Cells.Workbook.Ӿ(String ӿ, LoadOptions Ԁ)\r\n at Aspose.Cells.Workbook…ctor(String file, LoadOptions loadOptions)\r\n at TestAsposeCells2010.Program.LoadSheets() in C:\Users\Tim\documents\visual studio 2010\Projects\TestProjects\TestAsposeCells2010\TestAsposeCells2010\Program.cs:line 35\r\n at TestAsposeCells2010.Program.Main(String[] args) in C:\Users\Tim\documents\visual studio 2010\Projects\TestProjects\TestAsposeCells2010\TestAsposeCells2010\Program.cs:line 16


I have attached the workbook that I'm trying to load.
I am using Visual Studio 2010 and Aspose Cells v6.0.

If I save the workbook as Excel 97-2003 (using Excel 2010), it loads fine.

Any ideas?

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

--------------Example Code---------------------

static void Main(string[] args)

{

try

{

SetLicense();

LoadSheets();

}

catch (Exception ex)

{

Console.Out.WriteLine(ex.GetBaseException().Message);

Console.Out.WriteLine(ex.StackTrace);

}

Console.In.ReadLine();

}

private static void SetLicense()

{

License license;

license = new License();

license.SetLicense("Aspose.Cells.lic");

}

private static void LoadSheets()

{

Workbook workBook = new Workbook("TestWorkbook.xlsx", GetLoadOptions());

}

private static LoadOptions GetLoadOptions()

{

LoadOptions retVal = new LoadOptions(LoadFormat.Xlsx);

retVal.ConvertNumericData = true;

retVal.LoadDataOnly = true;

return retVal;

}

Hi,

Please download the latest version: Aspose.Cells for .NET v7.0.4.3

It is working fine, I have tested it with the code below. You can also see the output xlsx file generated by the code.

C#

string path = @“F:\Shak-Data-RW\Downloads\TestWorkbook.xlsx”;


Workbook wb = new Workbook(path);

wb.Save(path + “.out.xlsx”);