Free Support Forum - aspose.com

workbook.LoadData(fullFilePath- dataOption) is that API supported or is there any alternative API in latest ASPOSE cells for java 7.3.4?

Hello Aspose,

Workbook workbook = new Workbook();
LoadDataOption dataOption = new LoadDataOption();
dataOption.SheetIndexes = new int[]{1};

workbook.LoadData(fullFilePath, dataOption);

Above API is not supported in ASPOSE.cells for java 7.3.4 version. So wondering if there is any similar API to be used to load the workbook with just 1 or specified worksheet by index(s)?
That API seemed to be in Aspose.Cells 4.6.0.11 version or was it a customized version? Let us know.

Thanks,

Rita

Hi,


Please see the article for your reference:
http://www.aspose.com/docs/display/cellsnet/Load+only+Specific+Sheets+in+a+Workbook


The older Workbook.LoadData() is obsoleted now, instead you should always use Workbook constructor to specify your desired load data and file formats options using the recent/new versions.


Sample code:
//Load only specific sheets with data and formulas,
//Other objects, items etc. would also be extracted.

//Instantiate LoadOptions specified by the LoadFormat
LoadOptions loadOptions = new LoadOptions(LoadFormat.Excel97To2003);

//Set the LoadDataOption
LoadDataOption dataOption = new LoadDataOption();

//Specify the sheet(s) in the template file to be loaded - only the second worksheet.
dataOption.SheetIndexes = new int[] { 1 };
dataOption.ImportFormula = true;
loadOptions.LoadDataOnly = true;
//Specify the LoadDataOption
loadOptions.LoadDataOptions = dataOption;
//Create a Workbook object and opening the file from its path
Workbook wb = new Workbook(“e:\test\Book1.xls”, loadOptions);

wb.Save(“e:\test2\out_testingloadoptions.xls”);



Thank you.