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

Free Support Forum - aspose.com

Apply new work sheet OLE object not reflecting changes

I am developing using your wonder ASPOSE libraries. I discover the below function to change spreadsheet in wk book does not work. My designed program is to take xls.sheet1 and OLE update the ASPOSE.slide. slide2; so I have the following assignments xlssheet1=slide2;xlssheet2=slide4 and so on…



While debugging that I notice the xlsSheetnum high lighted below gets reflect the current looped program. But the output from the save ppt file does not. it always stuck to the FIRST XLS sheet.



Can you please advice why the wb.getWorksheets().get(xlsSheetNum); method does not reflect my sheet selection!!

After testing with numbers use cases

1) by switching btw pptx and pptm formats
2) testing with different versions of ASPOSE.cell\ASPOSE.slide library and nothing seem to matter.

I had written a simple program attached and it worked. I then revert back with simpler XLS file as source and found the problem is with the attached XLS file (6tab_excels - fail change sheet with method Wb.getWorksheets().get(2); It does not matter if I hardcode once switch to very simple spreadsheet I can switch sheets).

Attached exammple_6tab_excels.xls is a simpler version, we expect our XLS have many more tabs (unto 50). So please test with the attached XLS in your environment and raise the defect. This is urgent!!

Thank you

Hi Jeremy,

Thank you for the details.

Please share your template presentation file with us as well to further test the issue at our end. We will check it and get back to you soon.

Thanks & Regards,

Hi Owais,



Please find attached. I don’t think it matters. This is very simple powerpoint to show the defect as I just swap out. I can not share to real big one.

Hi Jeremy,

As per my understanding of your issue, you are trying to set the worksheet on second index as default worksheet which you open the ole object using pptx file. If that is the case, you need to set the particular worksheet as active sheet in the excel file. Following is the updated portion of the sample code you shared to make the worksheet active.


//Reading object data in Workbook
Workbook Wb;

Wb = new Workbook(“D://data//example_6tab_excels.xlsx”);

Wb.getWorksheets().get(2);

Wb.getWorksheets().setActiveSheetIndex(2);

com.aspose.cells.OoxmlSaveOptions so1 = new com.aspose.cells.OoxmlSaveOptions(com.aspose.cells.SaveFormat.XLSX);

ByteArrayOutputStream msout=new ByteArrayOutputStream();

//Saving modified excel sheet
Wb.save(msout, so1);

In case I am unable to understand the problem, please share some more details with us and we will assist you accordingly.

Thanks & Regards,

Thanks owais for the solution.

I tested without calling the get
Wb.getWorksheets().get(2);

and just with below
Wb.getWorksheets().setActiveSheetIndex(2);

Do you know if Wb.getWorksheets().get(2) is ever needed in my workflow for any other scenario?

Thanks

Hi Jeremy,

Thank you for the feedback.

I don’t think you need
Wb.getWorksheets().get(2) in your scenario as it is required to get a worksheet object to further process it. So, you can remove this line from your code.

In case you need any further assistance, please do let us know.

Thanks & Regards,