Spreadsheet: Issue #2402: Added functionality to get cell address given an alias.
This commit is contained in:
@@ -1131,6 +1131,21 @@ void Sheet::setComputedUnit(CellAddress address, const Base::Unit &unit)
|
||||
void Sheet::setAlias(CellAddress address, const std::string &alias)
|
||||
{
|
||||
cells.setAlias(address, alias);
|
||||
/**
|
||||
* @brief Get cell given an alias string
|
||||
* @param alias Alias for cell
|
||||
*
|
||||
* @returns Name of cell, or empty string if not defined
|
||||
*/
|
||||
|
||||
std::string Sheet::getAddressFromAlias(const std::string &alias) const
|
||||
{
|
||||
const Cell * cell = cells.getValueFromAlias(alias);
|
||||
|
||||
if (cell)
|
||||
return cell->getAddress().toString();
|
||||
else
|
||||
return std::string();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user