Created attachment 152795 [details] connect to LO server running A "TableRow" object doesn't seem to have any methods to access cells it stores. There's "getCellByPosition()", however this method accepts a row index, and is probably present in TableRow by mistake (should I report a bug on this?). Feel free to close this report if I'm wrong, I just spent some hours trying to understand how to loop over rows in a spreadsheet, and at this point I admit I am lost. # Steps to reproduce 1. Execute: soffice --calc --accept="socket,host=localhost,port=2002;urp;StarOffice.ServiceManager" 2. Download the attachment (python script to connect to LO) 3. In directory with the script run `python`, and execute: >>> exec(open("./connect-to-lo.py").read()) >>> row = model.CurrentController.ActiveSheet.Rows.getByIndex(0) 4. Now, try to get a cell from the row. ## Expected There's a way to do it. ## Actual Except the mentioned "getCellByPosition()" that is irrelevant to a row there doesn't seem to be a way to do it.
UPD: btw, turns out getCellByPosition() has not use either, because TableRow.Position property is incompatible with this function, and there doesn't seem to be a way to derive its index. Although I managed to find such call: row.getCellRangeByName(row.AbsoluteName) This returns a range, but… the range doesn't provide any means to get a cell either.
I asked on IRC: turns out, a row (which is basically a range) has a function getCellByPosition(), whose addressing is relative to the range. E.g. if your range starts at 1,1 global position, then your_range.getCellByPosition(0,0) would refer to 1,1 cell in global coordinates.
The row object is a cell range. It implements relevant services (e.g., com.sun.star.sheet.SheetCellRange, com.sun.star.table.CellRange), and interfaces (com.sun.star.table.XCellRange, com.sun.star.sheet.XCellRangeData, com.sun.star.sheet.XCellRangeFormula). The mentioned getCellByPosition (a method of XCellRange interface) allows you to get com.sun.star.table.XCell. You need to understand that indexing in a cell range object is relative to the range bounds; so for a given row (= a rectangular range of 1 row and many columns), the possible indices passed to aRow.getCellByPosition(colIx, rowIx) are 0..1048575 for colIx, and 0 for rowIx (regardless which row is represented by this aRow object). Closing NOTABUG (WORKSFORME is only for real defects that were fixed by an unknown commit).
(In reply to Mike Kaganski from comment #3) > ... 0..1048575 for colIx, of course, a typo: 0..1023 (currently, until bug 50916 is fixed).