Free Support Forum - aspose.com

Workbook.open

The new 5.1.0 dll shows the workbook.open method as obsolete, and says I should now use Workbook(stream,loadoptions). However, intellisense does not give me any clue as to what options I have, and in fact doesn't even recognize that method. The documentation on the website also shows the old method as obsolete, but I can't find any reference to the new method. The examples still show workbook.open.

The save also changed a bit, but intellisense does show the new format and it works ok.

Please explain how to use the new method to open a workbook.

Rick

Hi,

Well, yes, to clean the API Structures and re-organize the API, we have made Workbook.Open() method versions obsolete, but, this method will be eliminated after an year, so, still you may use your existing code (regarding Workbook.Open) the way it is, it will run fine.

But to use it in the new style, see the following segments of code for reference:

1)
FileStream stream = new FileStream(“e:\test\Book1.xlsx”, FileMode.Open);
LoadOptions loadOptions = new LoadOptions(LoadFormat.Xlsx);
Workbook wb = new Workbook(stream,loadOptions);

wb.Save(“e:\test\out_text.xlsx”);


2)

LoadOptions loadOptions = new
LoadOptions(LoadFormat.Xlsx);

Workbook wb = new Workbook(“e:\test\Book1.xlsx”, loadOptions);

//…

wb.Save(“e:\test\out_text.xlsx”);

And, we will soon update existing example codes in the docs.

Thank you.