diff --git a/include/xlnt/worksheet/range.hpp b/include/xlnt/worksheet/range.hpp
index 58e1953f..38dcca84 100644
--- a/include/xlnt/worksheet/range.hpp
+++ b/include/xlnt/worksheet/range.hpp
@@ -173,7 +173,7 @@ public:
///
///
///
- conditional_format conditional_format(const condition &when);
+ xlnt::conditional_format conditional_format(const condition &when);
///
/// Returns the first row or column in this range.
diff --git a/include/xlnt/worksheet/worksheet.hpp b/include/xlnt/worksheet/worksheet.hpp
index 77ad3c1e..764afd1a 100644
--- a/include/xlnt/worksheet/worksheet.hpp
+++ b/include/xlnt/worksheet/worksheet.hpp
@@ -661,7 +661,7 @@ public:
///
/// Creates a conditional format for the given range with the given condition.
///
- conditional_format conditional_format(const range_reference &ref, const condition &when);
+ xlnt::conditional_format conditional_format(const range_reference &ref, const condition &when);
private:
friend class cell;
diff --git a/source/detail/stylesheet.hpp b/source/detail/stylesheet.hpp
index 21d16226..c0261de6 100644
--- a/source/detail/stylesheet.hpp
+++ b/source/detail/stylesheet.hpp
@@ -66,6 +66,7 @@ struct stylesheet
{
auto iter = format_impls.begin();
std::advance(iter, static_cast::difference_type>(index));
+
return xlnt::format(&*iter);
}
@@ -497,6 +498,7 @@ struct stylesheet
void clear()
{
+ conditional_format_impls.clear();
format_impls.clear();
style_impls.clear();
diff --git a/source/detail/xlsx_producer.cpp b/source/detail/xlsx_producer.cpp
index 77014129..99890170 100755
--- a/source/detail/xlsx_producer.cpp
+++ b/source/detail/xlsx_producer.cpp
@@ -2364,7 +2364,7 @@ void xlsx_producer::write_worksheet(const relationship &rel)
write_end_element(xmlns, "mergeCells");
}
- // scope for conditional formatting production logic
+ if (source_.impl().stylesheet_.is_set())
{
const auto &stylesheet = source_.impl().stylesheet_.get();
const auto &cf_impls = stylesheet.conditional_format_impls;