Skip to content

Commit

Permalink
Spreadsheet: Issue #2402: Allow set to also accept alias name (in add…
Browse files Browse the repository at this point in the history
…ition to cell address).
  • Loading branch information
eivindkv authored and wwmayer committed Jan 26, 2016
1 parent 301fcc2 commit 6104662
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Mod/Spreadsheet/App/SheetPyImp.cpp
Expand Up @@ -67,10 +67,19 @@ PyObject* SheetPy::set(PyObject *args)
return 0;

try {
Range rangeIter(address);
do {
getSheetPtr()->setCell(rangeIter.address().c_str(), contents);
} while (rangeIter.next());
Sheet * sheet = getSheetPtr();
std::string cellAddress = sheet->getAddressFromAlias(address).c_str();

/* Check to see if address is really an alias first */
if (cellAddress.size() > 0)
sheet->setCell(cellAddress.c_str(), contents);
else {
Range rangeIter(address);

do {
sheet->setCell(rangeIter.address().c_str(), contents);
} while (rangeIter.next());
}
}
catch (const Base::Exception & e) {
PyErr_SetString(PyExc_ValueError, e.what());
Expand Down

0 comments on commit 6104662

Please sign in to comment.