Spreadsheet: Add Python API for getUsedCells

Also adds access to getNonEmptyCells, and unit tests for both. Designed
to fix #7587.
This commit is contained in:
Chris Hennes
2022-11-03 22:50:41 -05:00
parent b444ae94d5
commit 11dd7fc5f9
3 changed files with 76 additions and 0 deletions

View File

@@ -980,6 +980,27 @@ PyObject *SheetPy::recomputeCells(PyObject *args) {
}PY_CATCH;
}
PyObject *SheetPy::getUsedCells(PyObject *args)
{
auto usedCells = getSheetPtr()->getCells()->getUsedCells();
Py::List pyCellList;
for (const auto &cell : usedCells) {
pyCellList.append(Py::String(cell.toString()));
}
return Py::new_reference_to(pyCellList);
}
PyObject *SheetPy::getNonEmptyCells(PyObject *args)
{
auto usedCells = getSheetPtr()->getCells()->getNonEmptyCells();
Py::List pyCellList;
for (const auto &cell : usedCells) {
pyCellList.append(Py::String(cell.toString()));
}
return Py::new_reference_to(pyCellList);
}
// +++ custom attributes implementer ++++++++++++++++++++++++++++++++++++++++
PyObject *SheetPy::getCustomAttributes(const char*) const