#pragma once #include #include #include #include #include class test_range : public CxxTest::TestSuite { public: void test_batch_formatting() { xlnt::workbook wb; auto ws = wb.active_sheet(); for (auto row = 1; row <= 10; ++row) { for (auto column = 1; column <= 10; ++column) { ws.cell(column, row).value(xlnt::cell_reference(column, row).to_string()); } } ws.range("A1:A10").font(xlnt::font().name("Arial")); ws.range("A1:J1").font(xlnt::font().bold(true)); TS_ASSERT_EQUALS(ws.cell("A1").font().name(), "Calibri"); TS_ASSERT(ws.cell("A1").font().bold()); TS_ASSERT_EQUALS(ws.cell("A2").font().name(), "Arial"); TS_ASSERT(!ws.cell("A2").font().bold()); TS_ASSERT_EQUALS(ws.cell("B1").font().name(), "Calibri"); TS_ASSERT(ws.cell("B1").font().bold()); TS_ASSERT(!ws.cell("B2").has_format()); } };