Created attachment 152796 [details] script to try accessing "Sheets" in CurrentController If CurrentController offers ActiveSheet, why not to make it offer "Sheets" property as well? To me it doesn't make sense, and costed some hours of research until I blindly listed methods in XComponent that's higher the stack, and found "Sheets" there. # Steps to reproduce 1. Execute: soffice --calc --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" 2. Download the attachment (script to try accessing "Sheets" in CurrentController). 3. In directory with the script run `python ./connect-to-lo.py` # Expected Script finishes without errors # Actual Script fails on accessing model.CurrentController.Sheets
getSheets() method belongs to com::sun::star::sheet::SpreadsheetDocument Service (-> interface com::sun::star::sheet::XSpreadsheets): https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1sheet_1_1SpreadsheetDocument.html for example: https://docs.libreoffice.org/unotest/html/SpreadsheetDocument_8java_source.html https://api.libreoffice.org/examples/DevelopersGuide/Forms/SpreadsheetDocument.java
to make your example script work: soffice --calc --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" [...] model = connect_to_lo() print("Trying to access model.Sheets") sheets1 = model.getSheets() print("Succeed!") print(sheets1.getByIndex(0).getName())
(In reply to Oliver Brinzing from comment #2) > to make your example script work: > > soffice --calc > --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" > > [...] > model = connect_to_lo() > print("Trying to access model.Sheets") > sheets1 = model.getSheets() > print("Succeed!") > print(sheets1.getByIndex(0).getName()) You basically reworded my description here, where I mentioned that I know how to make it work. This report is about making the API more accessible. Do you mind to reopen it?
(In reply to Konstantin Kharlamov from comment #3) > You basically reworded my description here, where I mentioned that I know > how to make it work. This report is about making the API more accessible. > > Do you mind to reopen it? you may have a look at: https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Frame-Controller-Model_Paradigm_in_OpenOffice.org