start fixing serialization for #230

This commit is contained in:
Thomas Fussell 2017-09-28 08:55:16 -04:00
parent 34270f2333
commit 75de03745b
3 changed files with 22 additions and 13 deletions

View File

@ -1372,6 +1372,8 @@ void xlsx_consumer::read_office_document(const std::string &content_type) // CT_
{
throw xlnt::invalid_file(content_type);
}
target_.d_->calculation_properties_.clear();
expect_start_element(qn("workbook", "workbook"), xml::content::complex);
skip_attribute(qn("mc", "Ignorable"));
@ -1513,7 +1515,17 @@ void xlsx_consumer::read_office_document(const std::string &content_type) // CT_
}
else if (current_workbook_element == qn("workbook", "calcPr")) // CT_CalcPr 0-1
{
skip_remaining_content(current_workbook_element);
xlnt::calculation_properties calc_props;
if (parser().attribute_present("calcId"))
{
calc_props.calc_id = parser().attribute<std::size_t>("calcId");
}
if (parser().attribute_present("concurrentCalc"))
{
calc_props.concurrent_calc = is_true(parser().attribute("concurrentCalc"));
}
target_.calculation_properties(calc_props);
parser().attribute_map(); // skip remaining
}
else if (current_workbook_element == qn("workbook", "oleSize")) // CT_OleSize 0-1
{

View File

@ -504,7 +504,7 @@ void xlsx_producer::write_workbook(const relationship &rel)
write_attribute("activeTab", view.active_tab.get());
}
if (view.auto_filter_date_grouping)
if (!view.auto_filter_date_grouping)
{
write_attribute("autoFilterDateGrouping", write_bool(view.auto_filter_date_grouping));
}
@ -519,17 +519,17 @@ void xlsx_producer::write_workbook(const relationship &rel)
write_attribute("minimized", write_bool(view.minimized));
}
if (view.show_horizontal_scroll)
if (!view.show_horizontal_scroll)
{
write_attribute("showHorizontalScroll", write_bool(view.show_horizontal_scroll));
}
if (view.show_sheet_tabs)
if (!view.show_sheet_tabs)
{
write_attribute("showSheetTabs", write_bool(view.show_sheet_tabs));
}
if (view.show_vertical_scroll)
if (!view.show_vertical_scroll)
{
write_attribute("showVerticalScroll", write_bool(view.show_vertical_scroll));
}
@ -1000,10 +1000,7 @@ void xlsx_producer::write_fill(const fill &f)
write_start_element(xmlns, "patternFill");
if (pattern.type() != pattern_fill_type::none)
{
write_attribute("patternType", pattern.type());
}
write_attribute("patternType", pattern.type());
if (pattern.foreground().is_set())
{

View File

@ -108,7 +108,7 @@ public:
{
break;
}
if (left_parser.qname() != right_parser.qname())
{
difference = true;
@ -202,7 +202,7 @@ public:
}
std::cout << std::endl;
}
bool match = true;
xlnt::workbook left_workbook;
@ -210,7 +210,7 @@ public:
xlnt::workbook right_workbook;
right_workbook.load(right);
auto &left_manifest = left_workbook.manifest();
auto &right_manifest = right_workbook.manifest();
@ -228,7 +228,7 @@ public:
break;
}
auto left_content_type = left_member.string() == "[Content_Types].xml"
? "[Content_Types].xml" : left_manifest.content_type(left_member);
auto right_content_type = left_member.string() == "[Content_Types].xml"