-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Hello
I like your toolkit and the OpenDocument format is very easy to understand and save your data in.
I have encountered a problem, whne I try to iterate all cells using the below code:
import org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument;
import org.odftoolkit.odfdom.doc.table.OdfTable;
import org.odftoolkit.odfdom.doc.table.OdfTableRow;
import org.odftoolkit.odfdom.doc.table.OdfTableCell;
OdfSpreadsheetDocument spreadsheet = OdfSpreadsheetDocument.loadDocument(filepath);
List<OdfTable> tables = spreadsheet.getSpreadsheetTables();
for (OdfTable table : tables) {
List<OdfTableRow> rows = table.getRowList();
for (OdfTableRow row : rows) {
List<OdfTableCell> cells = row.getCellList(); // .getCellList() is not recognized
for (OdfTableCell cell : cells) {
// Do something with cell
}
}
}
This code is not recognized row.getCellList();.
Instead if I use this approach, the iteration works, but it does not iterate over an OdfTableCell data type but it iterates a Node data type, which is not what I want:
import org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument;
import org.odftoolkit.odfdom.doc.table.OdfTable;
import org.odftoolkit.odfdom.doc.table.OdfTableRow;
import org.odftoolkit.odfdom.doc.table.OdfTableCell;
OdfSpreadsheetDocument spreadsheet = OdfSpreadsheetDocument.loadDocument(filepath);
List<OdfTable> tables = spreadsheet.getSpreadsheetTables();
for (OdfTable table : tables) {
List<OdfTableRow> rows = table.getRowList();
for (OdfTableRow row : rows) {
NodeList cells = row.getOdfElement().getChildNodes();
for (int i = 0; i < cells.getLength(); i++) {
Node cell = cells.item(i);
// Do something with cell
}
}
}
So my question is, why is .getCellList() missing when iterating rows and can it be added to the toolkit?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed