Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
troldal committed Nov 6, 2021
2 parents 4f5fa96 + 8398286 commit 8680d6c
Show file tree
Hide file tree
Showing 18 changed files with 635 additions and 700 deletions.
1 change: 0 additions & 1 deletion Examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ add_executable(Demo8 Demo8.cpp)
target_link_libraries(Demo8 PRIVATE OpenXLSX::OpenXLSX)



12 changes: 11 additions & 1 deletion Examples/Demo3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ int main()
wbk.addWorksheet("Sheet3");
printWorkbook(wbk);

cout << "Sheet1 active: " << (wbk.worksheet("Sheet1").isActive() ? "true" : "false") << endl;
cout << "Sheet2 active: " << (wbk.worksheet("Sheet2").isActive() ? "true" : "false") << endl;
cout << "Sheet3 active: " << (wbk.worksheet("Sheet3").isActive() ? "true" : "false") << endl;

wbk.worksheet("Sheet3").setActive();

cout << "Sheet1 active: " << (wbk.worksheet("Sheet1").isActive() ? "true" : "false") << endl;
cout << "Sheet2 active: " << (wbk.worksheet("Sheet2").isActive() ? "true" : "false") << endl;
cout << "Sheet3 active: " << (wbk.worksheet("Sheet3").isActive() ? "true" : "false") << endl;

// OpenXLSX provides three different classes to handle workbook sheets: XLSheet, XLWorksheet, and
// XLChartsheet. As you might have guessed, XLWorksheet and XLChartsheet represents worksheets
// and chartsheets, respectively. XLChartsheet only has a limited set of functionality.
Expand All @@ -41,7 +51,7 @@ int main()
// not a parent class to either XLWorksheet or XLChartsheet, and therefore cannot be used
// polymorphically.

// From an XLSheet object you can retreive the contained XLWorksheet or XLChartsheet object by
// From an XLSheet object you can retrieve the contained XLWorksheet or XLChartsheet object by
// using the 'get<>()' function:
auto s1 = wbk.sheet("Sheet2").get<XLWorksheet>();

Expand Down
6 changes: 3 additions & 3 deletions OpenXLSX/headers/XLCellValue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace OpenXLSX
// ===== set the m_type attribute to String.
else if constexpr (std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
std::is_same_v<std::decay_t<T>, const char*> ||
std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool>)
(std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool>))
{
m_type = XLValueType::String;
m_value = std::string(value);
Expand Down Expand Up @@ -238,7 +238,7 @@ namespace OpenXLSX

if constexpr (std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
std::is_same_v<std::decay_t<T>, const char*> ||
std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool>)
(std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool>))
return std::get<std::string>(m_value).c_str();

if constexpr (std::is_same_v<T, XLDateTime>) return XLDateTime(std::get<double>(m_value));
Expand Down Expand Up @@ -351,7 +351,7 @@ namespace OpenXLSX

else if constexpr (std::is_same_v<std::decay_t<T>, std::string> || std::is_same_v<std::decay_t<T>, std::string_view> ||
std::is_same_v<std::decay_t<T>, const char*> ||
std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool> && !std::is_same_v<T, XLCellValue>)
(std::is_same_v<std::decay_t<T>, char*> && !std::is_same_v<T, bool> && !std::is_same_v<T, XLCellValue>))
{
if constexpr (std::is_same_v<std::decay_t<T>, const char*> || std::is_same_v<std::decay_t<T>, char*>)
setString(value);
Expand Down
Loading

0 comments on commit 8680d6c

Please sign in to comment.