void test_write_hidden_worksheet() { xlnt::workbook wb; auto ws = wb.create_sheet(); ws.set_sheet_state(xlnt::sheet_state::hidden); wb.create_sheet(); xlnt::workbook_serializer serializer(wb); pugi::xml_document xml; serializer.write_workbook(xml); std::string expected_string = "<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">" " <workbookPr/>" " <bookViews>" " <workbookView activeTab=\"0\"/>" " </bookViews>" " <sheets>" " <sheet name=\"Sheet\" sheetId=\"1\" state=\"hidden\" r:id=\"rId1\"/>" " <sheet name=\"Sheet1\" sheetId=\"2\" r:id=\"rId2\"/>" " </sheets>" " <definedNames/>" " <calcPr calcId=\"124519\" fullCalcOnLoad=\"1\"/>" "</workbook>"; pugi::xml_document expected; expected.load(expected_string.c_str()); auto diff = Helper::compare_xml(expected, xml); TS_ASSERT(!diff); }
void test_write_hidden_single_worksheet() { xlnt::workbook wb; auto ws = wb.get_active_sheet(); ws.set_sheet_state(xlnt::page_setup::sheet_state::hidden); TS_ASSERT_THROWS(xlnt::write_workbook(wb), xlnt::value_error); }
void test_write_hidden_single_worksheet() { xlnt::workbook wb; auto ws = wb.get_active_sheet(); ws.set_sheet_state(xlnt::sheet_state::hidden); xlnt::workbook_serializer serializer(wb); TS_ASSERT_THROWS(serializer.write_workbook(), xlnt::value_error); }