Hi.
I have found one issue with worksheets panel. After changing active worksheet, panel of worksheet don’t move back to first worksheet
@Test
public void activeWorksheetTest() throws Exception { Workbook workbook = new Workbook(“D://in.xlsx”); for (int i = 0; i < workbook.getWorksheets().getCount(); i++) { workbook.getWorksheets().setActiveSheetIndex(i); workbook.getWorksheets().get(i).getCells().get(0, 0).putValue(i); } workbook.getWorksheets().setActiveSheetIndex(0); workbook.save(“D://out.xlsx”);}
Best regards. Alexey
Hi,
Please add a line to your code segment before saving the Excel file:
e.g
Sample code:
…
workbook.getSettings().setFirstVisibleTab(0);
Thank you.
Hi. Thanks it helps, but i don’t understand why first visible tab moves, when i move active sheet to end. And does not whan i moved active sheet to begin.
Best regards. Alexey
Hi,
Good to know that it figures out your issue now. Well, by default, if there are many worksheets, it scrolls to the last part/ portion and displays last few worksheet tabs when you open the file into MS Excel. So, you have to scroll to and make your desired tab visible accordingly for your needs.
Thank you.
Hi.
Is it possible to implement a behavior of sheet selection, like it did for MS Excel.
I have attached the excel file with macroses:
1) scrollSheet18 select a sheet18 and worksheet’s link displayed according with previous position. If we run macro from first sheet, that sheet18 will be last in worksheets bar. If scroll of worksheets bar not required - worksheet will be selected without scroll.
2) scrollSheet2 select a sheet2 and worksheet’s link displayed according with previous position. If we run macro from 18’s sheet, that sheet2 will be first in worksheets bar. If scroll of worksheets bar not required - worksheet will be selected without scroll.
Best regards. Alexey
Hi,
Thanks for the template file.
Please see the document on how to add VBA code/ macros in the Excel spreadsheets:
Aspose.Cells can add/ manipulate macros/ vba codes but does not support to execute macros/vba codes in the template file. Furthermore, you may also try to move a worksheet within a workbook or in b/w workbooks, see the document for your reference here:
Also, when I run the macro “selectSheet18” in the template file, I got the error, see the screen shot for your reference here:
Thank you.
Hi. I don’t needed to save macros in Excel. I needed to have same implementation of workbook.setSheet of Aspose’s method. Please check this file
Best regards