| 141 | } |
| 142 | |
| 143 | std::string DrawViewSpreadsheet::getSheetImage() |
| 144 | { |
| 145 | App::DocumentObject* link = Source.getValue(); |
| 146 | |
| 147 | std::string scellstart = CellStart.getValue(); |
| 148 | std::string scellend = CellEnd.getValue(); |
| 149 | |
| 150 | //s/s columns are A, B,C, ... ZX, ZY, ZZ |
| 151 | //lower case characters are not valid |
| 152 | transform(scellstart.begin(), scellstart.end(), scellstart.begin(), ::toupper); |
| 153 | transform(scellend.begin(), scellend.end(), scellend.begin(), ::toupper); |
| 154 | |
| 155 | std::string colPart; |
| 156 | std::string rowPart; |
| 157 | boost::regex re{"([A-Z]*)([0-9]*)"}; |
| 158 | boost::smatch what; |
| 159 | int iRowStart = 0, iRowEnd = 0; |
| 160 | std::string sColStart, sColEnd; |
| 161 | if (boost::regex_search(scellstart, what, re)) { |
| 162 | if (what.size() < 3) { |
| 163 | Base::Console().error("%s - start cell (%s) is invalid\n", getNameInDocument(), |
| 164 | CellStart.getValue()); |
| 165 | return std::string(); |
| 166 | } |
| 167 | |
| 168 | colPart = what[1]; |
| 169 | sColStart = colPart; |
| 170 | rowPart = what[2]; |
| 171 | try { |
| 172 | iRowStart = std::stoi(rowPart); |
| 173 | } |
| 174 | catch (...) { |
| 175 | Base::Console().error("%s - start cell (%s) invalid row\n", |
| 176 | getNameInDocument(), rowPart.c_str()); |
| 177 | return std::string(); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | if (boost::regex_search(scellend, what, re)) { |
| 182 | if (what.size() < 3) { |
| 183 | Base::Console().error("%s - end cell (%s) is invalid\n", getNameInDocument(), CellEnd.getValue()); |
| 184 | } else { |
| 185 | colPart = what[1]; |
| 186 | sColEnd = colPart; |
| 187 | rowPart = what[2]; |
| 188 | try { |
| 189 | iRowEnd = std::stoi(rowPart); |
| 190 | } |
| 191 | catch (...) { |
| 192 | Base::Console().error("%s - end cell (%s) invalid row\n", |
| 193 | getNameInDocument(), rowPart.c_str()); |
| 194 | return std::string(); |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | const std::vector <std::string> availcolumns = getAvailColumns(); |
| 200 |
nothing calls this directly
no test coverage detected