[Spreadsheet] avoid removing user dynamic properties when clearing cells, addresses issue #8655

This commit is contained in:
mwganson
2024-10-18 02:57:39 +00:00
parent ea528ecdb9
commit 8094e22417
3 changed files with 37 additions and 21 deletions

View File

@@ -109,7 +109,11 @@ Sheet::~Sheet()
}
/**
* Clear all cells in the sheet.
* Clear all cells in the sheet. These are implemented as dynamic
* properties, for example "A1" is added as a dynamic property. Since
* now users may add dyanamic properties, we need to try to avoid
* removing those, too, so we check whether the dynamic property name
* is a valid cell address name before removing it.
*/
void Sheet::clearAll()
@@ -119,7 +123,9 @@ void Sheet::clearAll()
std::vector<std::string> propNames = props.getDynamicPropertyNames();
for (const auto& propName : propNames) {
this->removeDynamicProperty(propName.c_str());
if (cells.isValidCellAddressName(propName.c_str())) {
this->removeDynamicProperty(propName.c_str());
}
}
propAddress.clear();