mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Merge pull request #49 from xpol/add-missing-overload-for-worksheet-rows
Add range worksheet::rows(int row_offset, int column_offset) const.
This commit is contained in:
commit
7c047c70f8
|
@ -152,6 +152,36 @@ public:
|
||||||
expected_row_iter++;
|
expected_row_iter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_iter_rows_offset_int_int()
|
||||||
|
{
|
||||||
|
xlnt::workbook wb;
|
||||||
|
xlnt::worksheet ws(wb);
|
||||||
|
auto rows = ws.rows(1, 3);
|
||||||
|
|
||||||
|
const std::vector<std::vector<std::string>> expected =
|
||||||
|
{
|
||||||
|
{ "D2", "E2", "F2" },
|
||||||
|
{ "D3", "E3", "F3" },
|
||||||
|
{ "D4", "E4", "F4" },
|
||||||
|
{ "D5", "E5", "F5" }
|
||||||
|
};
|
||||||
|
|
||||||
|
auto expected_row_iter = expected.begin();
|
||||||
|
|
||||||
|
for (auto row : rows)
|
||||||
|
{
|
||||||
|
auto expected_cell_iter = (*expected_row_iter).begin();
|
||||||
|
|
||||||
|
for (auto cell : row)
|
||||||
|
{
|
||||||
|
TS_ASSERT_EQUALS(cell.get_reference(), *expected_cell_iter);
|
||||||
|
expected_cell_iter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
expected_row_iter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void test_get_named_range()
|
void test_get_named_range()
|
||||||
{
|
{
|
||||||
|
|
|
@ -626,6 +626,12 @@ xlnt::range worksheet::rows(const std::string &range_string, int row_offset, int
|
||||||
return get_range(reference.make_offset(column_offset, row_offset));
|
return get_range(reference.make_offset(column_offset, row_offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xlnt::range worksheet::rows(int row_offset, int column_offset) const
|
||||||
|
{
|
||||||
|
range_reference reference(calculate_dimension());
|
||||||
|
return get_range(reference.make_offset(column_offset, row_offset));
|
||||||
|
}
|
||||||
|
|
||||||
xlnt::range worksheet::columns() const
|
xlnt::range worksheet::columns() const
|
||||||
{
|
{
|
||||||
return range(*this, calculate_dimension(), major_order::column);
|
return range(*this, calculate_dimension(), major_order::column);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user