Spreadsheet: Issue #2402: Added getAlias function.
This commit is contained in:
parent
610466284b
commit
e8eef1dfcb
|
@ -110,6 +110,11 @@
|
|||
<UserDocu>Set alias for cell address</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getAlias">
|
||||
<Documentation>
|
||||
<UserDocu>Get alias for cell address</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getCellFromAlias">
|
||||
<Documentation>
|
||||
<UserDocu>Get cell address given an alias</UserDocu>
|
||||
|
|
|
@ -473,6 +473,31 @@ PyObject* SheetPy::setAlias(PyObject *args)
|
|||
}
|
||||
}
|
||||
|
||||
PyObject* SheetPy::getAlias(PyObject *args)
|
||||
{
|
||||
const char * strAddress;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s:getAlias", &strAddress))
|
||||
return 0;
|
||||
|
||||
try {
|
||||
CellAddress address(strAddress);
|
||||
const Cell * cell = getSheetPtr()->getCell(address);
|
||||
std::string alias;
|
||||
|
||||
if (cell && cell->getAlias(alias))
|
||||
return Py::new_reference_to( Py::String( alias ) );
|
||||
else {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception & e) {
|
||||
PyErr_SetString(PyExc_ValueError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* SheetPy::getCellFromAlias(PyObject *args)
|
||||
{
|
||||
const char * alias;
|
||||
|
|
Loading…
Reference in New Issue
Block a user