diff --git a/include/xlnt/styles/format.hpp b/include/xlnt/styles/format.hpp old mode 100644 new mode 100755 index bca19b22..079e0262 --- a/include/xlnt/styles/format.hpp +++ b/include/xlnt/styles/format.hpp @@ -189,6 +189,16 @@ public: /// bool protection_applied() const; + /// + /// + /// + bool pivot_button_applied() const; + + /// + /// + /// + bool quote_prefix_applied() const; + // Style /// diff --git a/include/xlnt/styles/style.hpp b/include/xlnt/styles/style.hpp old mode 100644 new mode 100755 index 5d6468f1..c363c22b --- a/include/xlnt/styles/style.hpp +++ b/include/xlnt/styles/style.hpp @@ -227,6 +227,16 @@ public: /// bool protection_applied() const; + /// + /// + /// + bool pivot_button_applied() const; + + /// + /// + /// + bool quote_prefix_applied() const; + /// /// /// diff --git a/source/detail/format_impl.hpp b/source/detail/format_impl.hpp old mode 100644 new mode 100755 index 85dacdeb..27a02e16 --- a/source/detail/format_impl.hpp +++ b/source/detail/format_impl.hpp @@ -47,10 +47,14 @@ struct format_impl optional protection_id; bool protection_applied = false; + bool pivot_button_applied = false; + + bool quote_prefix_applied = false; + optional style; - + std::size_t references = 0; - + XLNT_API friend bool operator==(const format_impl &left, const format_impl &right) { return left.parent == right.parent diff --git a/source/detail/style_impl.hpp b/source/detail/style_impl.hpp old mode 100644 new mode 100755 index 3857422a..869fd73b --- a/source/detail/style_impl.hpp +++ b/source/detail/style_impl.hpp @@ -48,6 +48,10 @@ struct style_impl optional protection_id; bool protection_applied = false; + + bool pivot_button_applied = false; + + bool quote_prefix_applied = false; }; } // namespace detail diff --git a/source/detail/xlsx_consumer.cpp b/source/detail/xlsx_consumer.cpp index fa0973c8..c88ffba3 100755 --- a/source/detail/xlsx_consumer.cpp +++ b/source/detail/xlsx_consumer.cpp @@ -1521,6 +1521,14 @@ void xlsx_consumer::read_stylesheet() record.first.protection_applied = apply_protection_present && is_true(parser().attribute("applyProtection")); + auto pivot_button_present = parser().attribute_present("pivotButton"); + record.first.pivot_button_applied = pivot_button_present + && is_true(parser().attribute("pivotButton")); + + auto quote_prefix_present = parser().attribute_present("quotePrefix"); + record.first.quote_prefix_applied = quote_prefix_present + && is_true(parser().attribute("quotePrefix")); + if (parser().attribute_present("xfId") && parser().name() == "cellXfs") { record.second = parser().attribute("xfId"); @@ -1735,6 +1743,8 @@ void xlsx_consumer::read_stylesheet() new_format.number_format_applied = record.first.number_format_applied; new_format.protection_id = record.first.protection_id; new_format.protection_applied = record.first.protection_applied; + new_format.pivot_button_applied = record.first.pivot_button_applied; + new_format.quote_prefix_applied = record.first.quote_prefix_applied; } } @@ -2133,6 +2143,8 @@ void xlsx_consumer::read_worksheet(const std::string &rel_id) else if (current_worksheet_element == qn("spreadsheetml", "autoFilter")) // CT_AutoFilter 0-1 { ws.auto_filter(xlnt::range_reference(parser().attribute("ref"))); + // auto filter complex + skip_remaining_content(current_worksheet_element); } else if (current_worksheet_element == qn("spreadsheetml", "sortState")) // CT_SortState 0-1 { @@ -2461,7 +2473,7 @@ void xlsx_consumer::read_comments(worksheet ws) expect_start_element(qn("spreadsheetml", "comment"), xml::content::complex); skip_attribute("shapeId"); - auto cell_ref = parser().attribute("ref"); + auto cell_ref = parser().attribute("ref"); auto author_id = parser().attribute("authorId"); expect_start_element(qn("spreadsheetml", "text"), xml::content::complex); @@ -2743,12 +2755,12 @@ rich_text xlsx_consumer::read_rich_text(const xml::qname &parent) else if (current_run_property_element == xml::qname(xmlns, "b")) { run.second.get().bold(parser().attribute_present("val") - ? is_true(parser().attribute("val")) : true); + ? is_true(parser().attribute("val")) : true); } else if (current_run_property_element == xml::qname(xmlns, "i")) { run.second.get().italic(parser().attribute_present("val") - ? is_true(parser().attribute("val")) : true); + ? is_true(parser().attribute("val")) : true); } else if (current_run_property_element == xml::qname(xmlns, "u")) { diff --git a/source/detail/xlsx_producer.cpp b/source/detail/xlsx_producer.cpp old mode 100644 new mode 100755 index da8edac5..f34644a9 --- a/source/detail/xlsx_producer.cpp +++ b/source/detail/xlsx_producer.cpp @@ -58,15 +58,15 @@ std::vector> core_property_namespace(xlnt::c using xlnt::core_property; using xlnt::constants; - if (type == core_property::created + if (type == core_property::created || type == core_property::modified) { return {{constants::ns("dcterms"), "dcterms"}, {constants::ns("xsi"), "xsi"}}; } - else if (type == core_property::title - || type == core_property::subject - || type == core_property::creator + else if (type == core_property::title + || type == core_property::subject + || type == core_property::creator || type == core_property::description) { return {{constants::ns("dc"), "dc"}}; @@ -364,7 +364,7 @@ void xlsx_producer::write_extended_properties(const relationship &/*rel*/) for (const auto &prop : source_.extended_properties()) { - write_property(to_string(prop), source_.extended_property(prop), + write_property(to_string(prop), source_.extended_property(prop), constants::ns("extended-properties"), false, 0); } @@ -1175,6 +1175,16 @@ void xlsx_producer::write_styles(const relationship & /*rel*/) write_attribute("applyProtection", write_bool(true)); } + if (current_style_impl.pivot_button_applied) + { + write_attribute("pivotButton", write_bool(true)); + } + + if (current_style_impl.quote_prefix_applied) + { + write_attribute("quotePrefix", write_bool(true)); + } + if (current_style_impl.alignment_id.is_set()) { const auto ¤t_alignment = stylesheet.alignments[current_style_impl.alignment_id.get()]; @@ -1229,7 +1239,7 @@ void xlsx_producer::write_styles(const relationship & /*rel*/) write_end_element(xmlns, "cellStyleXfs"); } - + // Format XFs write_start_element(xmlns, "cellXfs"); @@ -1283,6 +1293,16 @@ void xlsx_producer::write_styles(const relationship & /*rel*/) write_attribute("applyProtection", write_bool(true)); } + if (current_format_impl.pivot_button_applied) + { + write_attribute("pivotButton", write_bool(true)); + } + + if (current_format_impl.quote_prefix_applied) + { + write_attribute("quotePrefix", write_bool(true)); + } + if (current_format_impl.style.is_set()) { write_attribute("xfId", stylesheet.style_index(current_format_impl.style.get())); diff --git a/source/styles/format.cpp b/source/styles/format.cpp old mode 100644 new mode 100755 index baa5e9f1..57588204 --- a/source/styles/format.cpp +++ b/source/styles/format.cpp @@ -210,5 +210,14 @@ bool format::protection_applied() const { return d_->protection_applied; } +bool format::pivot_button_applied() const +{ + return d_->pivot_button_applied; +} + +bool format::quote_prefix_applied() const +{ + return d_->quote_prefix_applied; +} } // namespace xlnt diff --git a/source/styles/style.cpp b/source/styles/style.cpp old mode 100644 new mode 100755 index 520206e8..0b574630 --- a/source/styles/style.cpp +++ b/source/styles/style.cpp @@ -238,4 +238,14 @@ bool style::protection_applied() const return d_->protection_applied; } +bool style::pivot_button_applied() const +{ + return d_->pivot_button_applied; +} + +bool style::quote_prefix_applied() const +{ + return d_->quote_prefix_applied; +} + } // namespace xlnt