11#ifndef OPENXLSX_XLSHEET_HPP
12#define OPENXLSX_XLSHEET_HPP
16# pragma warning(disable : 4251)
17# pragma warning(disable : 4275)
25#include "OpenXLSX-Exports.hpp"
113 uint16_t
index()
const;
124 std::string
name()
const;
159 template<
typename SheetType,
160 typename = std::enable_if_t<std::is_same_v<SheetType, XLWorksheet> or std::is_same_v<SheetType, XLChartsheet>>>
162 {
return std::holds_alternative<SheetType>(m_sheet); }
170 void clone(
const std::string& newName);
177 template<
typename T,
typename = std::enable_if_t<std::is_same_v<T, XLWorksheet> or std::is_same_v<T, XLChartsheet>>>
181 if constexpr (std::is_same<T, XLWorksheet>::value)
182 return std::get<XLWorksheet>(m_sheet);
184 else if constexpr (std::is_same<T, XLChartsheet>::value)
185 return std::get<XLChartsheet>(m_sheet);
188 catch (
const std::bad_variant_access&) {
189 throw XLSheetError(
"XLSheet object does not contain the requested sheet type.");
208 void print(std::basic_ostream<char>& ostr)
const;
211 std::variant<XLWorksheet, XLChartsheet> m_sheet;
Class representing an Excel chartsheet.
Definition XLChartsheet.hpp:25
Definition XLColor.hpp:32
Definition XLException.hpp:96
uint16_t index() const
Method for getting the index of the sheet.
Definition XLSheet.cpp:164
XLSheet(const XLSheet &other)=default
The copy constructor.
bool isType() const
Method to get the type of the sheet.
Definition XLSheet.hpp:161
T get() const
Definition XLSheet.hpp:178
void setIndex(uint16_t index)
Method for setting the index of the sheet. This effectively moves the sheet to a different position.
Definition XLSheet.cpp:169
XLSheet & operator=(const XLSheet &other)=default
Assignment operator.
bool isSelected() const
Determine whether the sheet is selected.
Definition XLSheet.cpp:184
void setVisibility(XLSheetState state)
Method for setting the state of the sheet.
Definition XLSheet.cpp:149
XLSheet & operator=(XLSheet &&other) noexcept=default
XLSheet(XLXmlData *xmlData)
The constructor. There are no default constructor, so all parameters must be provided for constructin...
Definition XLSheet.cpp:136
XLSheetState visibility() const
Method for getting the current visibility state of the sheet.
Definition XLSheet.cpp:144
void setName(const std::string &name)
Method for renaming the sheet.
Definition XLSheet.cpp:179
bool setActive()
Definition XLSheet.cpp:199
void setColor(const XLColor &color)
Definition XLSheet.cpp:159
XLSheet(XLSheet &&other) noexcept=default
~XLSheet()=default
The destructor.
bool isActive() const
Definition XLSheet.cpp:194
void setSelected(bool selected)
Definition XLSheet.cpp:189
std::string name() const
Method to retrieve the name of the sheet.
Definition XLSheet.cpp:174
XLColor color() const
Definition XLSheet.cpp:154
A class encapsulating an Excel worksheet. Access to XLWorksheet objects should be via the workbook ob...
Definition XLWorksheet.hpp:132
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an ....
Definition XLXmlData.hpp:79
std::string xmlData(XLXmlSavingDeclaration savingDeclaration=XLXmlSavingDeclaration{}) const
Method for getting the XML data represented by the object.
Definition XLXmlFile.cpp:49
XLXmlFile()=default
Default constructor.
Definition IXLCellProvider.hpp:24
XLSheetState
The XLSheetState is an enumeration of the possible (visibility) states, e.g. Visible or Hidden.
Definition XLSheetBase.hpp:35