Merge pull request #17315 from mwganson/ssclearall

[Spreadsheet] avoid removing user dynamic properties when clearing ce…
This commit is contained in:
Chris Hennes
2024-12-06 11:57:45 -05:00
committed by GitHub
8 changed files with 155 additions and 21 deletions

View File

@@ -108,7 +108,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()
@@ -118,7 +122,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();