1#ifndef OPENXLSX_XLPIVOTTABLE_HPP
2#define OPENXLSX_XLPIVOTTABLE_HPP
4#include "OpenXLSX-Exports.hpp"
12 enum class XLPivotSubtotal {
Sum,
Average,
Count,
Max,
Min,
Product,
CountNums,
StdDev,
StdDevP,
Var,
VarP };
33 : m_name(
std::move(name)), m_sourceRange(
std::move(sourceRange)), m_targetCell(
std::move(targetCell)) {}
38 m_rows.push_back({std::move(fieldName), XLPivotSubtotal::Sum,
"", 0, std::move(selectedItems)});
43 m_columns.push_back({std::move(fieldName), XLPivotSubtotal::Sum,
"", 0, std::move(selectedItems)});
48 m_data.push_back({std::move(fieldName), subtotal, std::move(customName), numFmtId, {}});
53 m_filters.push_back({std::move(fieldName), XLPivotSubtotal::Sum,
"", 0, std::move(selectedItems)});
78 [[nodiscard]]
const std::string&
name()
const {
return m_name; }
79 [[nodiscard]]
const std::string&
sourceRange()
const {
return m_sourceRange; }
80 [[nodiscard]]
const std::string&
targetCell()
const {
return m_targetCell; }
81 [[nodiscard]]
const std::vector<XLPivotField>&
rows()
const {
return m_rows; }
82 [[nodiscard]]
const std::vector<XLPivotField>&
columns()
const {
return m_columns; }
83 [[nodiscard]]
const std::vector<XLPivotField>&
data()
const {
return m_data; }
84 [[nodiscard]]
const std::vector<XLPivotField>&
filters()
const {
return m_filters; }
87 [[nodiscard]]
bool dataOnRows()
const {
return m_dataOnRows; }
90 [[nodiscard]]
bool showDrill()
const {
return m_showDrill; }
93 [[nodiscard]]
bool mergeItem()
const {
return m_mergeItem; }
94 [[nodiscard]]
bool compactData()
const {
return m_compactData; }
95 [[nodiscard]]
bool showError()
const {
return m_showError; }
108 std::string m_sourceRange;
109 std::string m_targetCell;
111 std::vector<XLPivotField> m_rows;
112 std::vector<XLPivotField> m_columns;
113 std::vector<XLPivotField> m_data;
114 std::vector<XLPivotField> m_filters;
116 bool m_dataOnRows {
false};
117 bool m_rowGrandTotals {
true};
118 bool m_colGrandTotals {
true};
119 bool m_showDrill {
true};
120 bool m_useAutoFormatting {
false};
121 bool m_pageOverThenDown {
false};
122 bool m_mergeItem {
false};
123 bool m_compactData {
true};
124 bool m_showError {
false};
125 bool m_showRowHeaders {
true};
126 bool m_showColHeaders {
true};
127 bool m_showRowStripes {
false};
128 bool m_showColStripes {
false};
129 bool m_showLastColumn {
false};
131 bool m_classicLayout {
false};
132 bool m_fieldPrintTitles {
false};
133 bool m_itemPrintTitles {
false};
135 std::string m_pivotTableStyleName{
"PivotStyleLight16"};
151 void setName(std::string_view name);
156 void setRefreshOnLoad(
bool refresh =
true);
161 std::string name()
const;
166 std::string targetCell()
const;
171 std::string sourceRange()
const;
182 void changeSourceRange(std::string_view newRange);
201 std::string sourceRange()
const;
207 void changeSourceRange(std::string_view newRange);
Definition XLPivotTable.hpp:186
~XLPivotCacheDefinition()=default
XLPivotCacheDefinition(XLPivotCacheDefinition &&other) noexcept=default
XLPivotCacheDefinition()
Definition XLPivotTable.hpp:190
XLPivotCacheDefinition & operator=(const XLPivotCacheDefinition &other)=default
XLPivotCacheDefinition & operator=(XLPivotCacheDefinition &&other) noexcept=default
XLPivotCacheDefinition(const XLPivotCacheDefinition &other)=default
Definition XLPivotTable.hpp:211
XLPivotCacheRecords & operator=(const XLPivotCacheRecords &other)=default
~XLPivotCacheRecords()=default
XLPivotCacheRecords()
Definition XLPivotTable.hpp:213
XLPivotCacheRecords & operator=(XLPivotCacheRecords &&other) noexcept=default
XLPivotCacheRecords(const XLPivotCacheRecords &other)=default
XLPivotCacheRecords(XLPivotCacheRecords &&other) noexcept=default
Definition XLPivotTable.hpp:24
bool dataOnRows() const
Definition XLPivotTable.hpp:87
XLPivotTableOptions & setFieldPrintTitles(bool value)
Definition XLPivotTable.hpp:74
XLPivotTableOptions & setShowRowStripes(bool value)
Definition XLPivotTable.hpp:69
XLPivotTableOptions & setRowGrandTotals(bool value)
Definition XLPivotTable.hpp:59
bool showColStripes() const
Definition XLPivotTable.hpp:99
const std::string & targetCell() const
Definition XLPivotTable.hpp:80
XLPivotTableOptions & setUseAutoFormatting(bool value)
Definition XLPivotTable.hpp:62
XLPivotTableOptions & addDataField(std::string fieldName, std::string customName="", XLPivotSubtotal subtotal=XLPivotSubtotal::Sum, uint32_t numFmtId=0)
Definition XLPivotTable.hpp:47
XLPivotTableOptions & setItemPrintTitles(bool value)
Definition XLPivotTable.hpp:75
bool useAutoFormatting() const
Definition XLPivotTable.hpp:91
XLPivotTableOptions & addFilterField(std::string fieldName, std::vector< std::string > selectedItems={})
Definition XLPivotTable.hpp:52
XLPivotTableOptions & setColGrandTotals(bool value)
Definition XLPivotTable.hpp:60
bool showRowHeaders() const
Definition XLPivotTable.hpp:96
bool classicLayout() const
Definition XLPivotTable.hpp:102
const std::string & pivotTableStyleName() const
Definition XLPivotTable.hpp:85
bool fieldPrintTitles() const
Definition XLPivotTable.hpp:103
XLPivotTableOptions & setShowLastColumn(bool value)
Definition XLPivotTable.hpp:71
const std::string & name() const
Definition XLPivotTable.hpp:78
bool showDrill() const
Definition XLPivotTable.hpp:90
XLPivotTableOptions & setCompactData(bool value)
Definition XLPivotTable.hpp:65
const std::vector< XLPivotField > & columns() const
Definition XLPivotTable.hpp:82
bool showLastColumn() const
Definition XLPivotTable.hpp:100
const std::string & sourceRange() const
Definition XLPivotTable.hpp:79
XLPivotTableOptions & setClassicLayout(bool value)
Definition XLPivotTable.hpp:73
XLPivotTableOptions & setPageOverThenDown(bool value)
Definition XLPivotTable.hpp:63
XLPivotTableOptions & setMergeItem(bool value)
Definition XLPivotTable.hpp:64
bool compactData() const
Definition XLPivotTable.hpp:94
const std::vector< XLPivotField > & data() const
Definition XLPivotTable.hpp:83
XLPivotTableOptions & setShowRowHeaders(bool value)
Definition XLPivotTable.hpp:67
bool pageOverThenDown() const
Definition XLPivotTable.hpp:92
bool showColHeaders() const
Definition XLPivotTable.hpp:97
XLPivotTableOptions & setShowColHeaders(bool value)
Definition XLPivotTable.hpp:68
XLPivotTableOptions & setShowError(bool value)
Definition XLPivotTable.hpp:66
const std::vector< XLPivotField > & filters() const
Definition XLPivotTable.hpp:84
XLPivotTableOptions & setShowColStripes(bool value)
Definition XLPivotTable.hpp:70
XLPivotTableOptions & setShowDrill(bool value)
Definition XLPivotTable.hpp:61
XLPivotTableOptions & addRowField(std::string fieldName, std::vector< std::string > selectedItems={})
Definition XLPivotTable.hpp:37
XLPivotTableOptions & setDataOnRows(bool value)
Definition XLPivotTable.hpp:58
XLPivotTableOptions & setPivotTableStyle(std::string styleName)
Definition XLPivotTable.hpp:57
bool showError() const
Definition XLPivotTable.hpp:95
XLPivotTableOptions(std::string name, std::string sourceRange, std::string targetCell)
Construct fully initialized Pivot Table options.
Definition XLPivotTable.hpp:32
XLPivotTableOptions & addColumnField(std::string fieldName, std::vector< std::string > selectedItems={})
Definition XLPivotTable.hpp:42
bool itemPrintTitles() const
Definition XLPivotTable.hpp:104
bool rowGrandTotals() const
Definition XLPivotTable.hpp:88
bool showRowStripes() const
Definition XLPivotTable.hpp:98
bool colGrandTotals() const
Definition XLPivotTable.hpp:89
bool mergeItem() const
Definition XLPivotTable.hpp:93
const std::vector< XLPivotField > & rows() const
Definition XLPivotTable.hpp:81
Definition XLPivotTable.hpp:139
XLPivotTable()
Definition XLPivotTable.hpp:143
XLPivotTable(const XLPivotTable &other)=default
XLPivotTable(XLPivotTable &&other) noexcept=default
XLPivotTable & operator=(const XLPivotTable &other)=default
XLPivotTable & operator=(XLPivotTable &&other) noexcept=default
Definition XLRelationships.hpp:140
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an ....
Definition XLXmlData.hpp:68
The XLXmlFile class provides an interface for derived classes to use. It functions as an ancestor to ...
Definition XLXmlFile.hpp:42
Definition IZipArchive.hpp:18
XLPivotSubtotal
Definition XLPivotTable.hpp:12
Definition XLCellIterator.hpp:121
Definition XLPivotTable.hpp:15
std::vector< std::string > selectedItems
Definition XLPivotTable.hpp:20
std::string customName
Definition XLPivotTable.hpp:18
std::string name
Definition XLPivotTable.hpp:16
XLPivotSubtotal subtotal
Definition XLPivotTable.hpp:17
uint32_t numFmtId
Definition XLPivotTable.hpp:19