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 643b048c..761e08ae 100755
--- a/source/detail/xlsx_consumer.cpp
+++ b/source/detail/xlsx_consumer.cpp
@@ -1488,10 +1488,7 @@ void xlsx_consumer::read_stylesheet()
while (in_element(current_style_element))
{
expect_start_element(qn("spreadsheetml", "xf"), xml::content::complex);
- // temporary to analyse
- skip_attribute("pivotButton");
- skip_attribute("quotePrefix");
-
+
auto &record = *(!in_style_records
? format_records.emplace(format_records.end())
: style_records.emplace(style_records.end()));
@@ -1524,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");
@@ -1738,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;
}
}
@@ -2136,8 +2143,19 @@ 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")));
- // complex type
- skip_remaining_content(current_worksheet_element);
+ //while (in_element(qn("spreadsheetml", "autoFilter")))
+ //{
+ skip_remaining_content(current_worksheet_element);
+ //}
+ //auto fste = expect_start_element(xml::content::simple);
+ //if (parser().element_present("filterColumn"))
+ //if(fste == qn("spreadsheetml", "filterColumn"))
+ //{
+ //skip_attributes({"colId", "showButton"});
+ // skip_remaining_content(fste);
+ //expect_end_element(qn("spreadsheetml", "filterColumn"));
+ //}
+ //expect_end_element(qn("spreadsheetml", "autoFilter"));
}
else if (current_worksheet_element == qn("spreadsheetml", "sortState")) // CT_SortState 0-1
{
@@ -2466,7 +2484,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);
@@ -2535,7 +2553,11 @@ variant xlsx_consumer::read_variant()
}
if (element == qn("vt", "bool"))
{
- value = variant(is_true(text));
+ // bool could be "0" or "false"
+ bool bvalue;
+ if (text[0] == '0' or text[0] == 'f' or text[0]=='F') bvalue = false;
+ else bvalue = true;
+ value = variant(bvalue);
}
else if (element == qn("vt", "vector"))
{
@@ -2651,8 +2673,12 @@ std::vector xlsx_consumer::read_namespaces()
bool xlsx_consumer::in_element(const xml::qname &name)
{
- return parser().peek() != xml::parser::event_type::end_element
- && stack_.back() == name;
+
+ if ((parser().peek() == xml::parser::event_type::end_element ) && (stack_.back() == name ))
+ {
+ return false;
+ }
+ return true;
}
xml::qname xlsx_consumer::expect_start_element(xml::content content)
@@ -2747,13 +2773,13 @@ 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);
+ run.second.get().bold(
+ parser().attribute_present("val") ? 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);
+ run.second.get().bold(
+ parser().attribute_present("val") ? 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 f93466b3..ab9823a4
--- 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"}};
@@ -363,7 +363,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);
}
@@ -1174,6 +1174,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()];
@@ -1228,7 +1238,7 @@ void xlsx_producer::write_styles(const relationship & /*rel*/)
write_end_element(xmlns, "cellStyleXfs");
}
-
+
// Format XFs
write_start_element(xmlns, "cellXfs");
@@ -1282,6 +1292,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