always read all cells to work around xlsxio bug

otherwise xlsxio will return a spurious empty row on next row read
develop
myk002 2021-03-26 19:43:15 -07:00
parent 222feff342
commit 4d2af8438f
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 6 additions and 3 deletions

@ -115,9 +115,12 @@ int get_row(lua_State *L) {
std::string value;
auto cells = std::vector<std::string>();
while (get_next_cell(sheet_handle, value)) {
// read all cells in the row, even if we don't need to;
// otherwise xlsxio will return a spurious empty row on
// next call
if (max_tokens <= 0 || cells.size() < max_tokens) {
cells.push_back(value);
if (max_tokens > 0 && cells.size() >= max_tokens)
break;
}
}
Lua::PushVector(L, cells, true);
}