OpenXLSX 1.9.1
Loading...
Searching...
No Matches
XLProperties.hpp
Go to the documentation of this file.
1#ifndef OPENXLSX_XLPROPERTIES_HPP
2#define OPENXLSX_XLPROPERTIES_HPP
3
4#ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
5# pragma warning(push)
6# pragma warning(disable : 4251)
7# pragma warning(disable : 4275)
8#endif // _MSC_VER
9
10// ===== External Includes ===== //
11#include <string>
12#include <string_view>
13#include <vector>
14
15// ===== OpenXLSX Includes ===== //
16#include "OpenXLSX-Exports.hpp"
17#include "XLDateTime.hpp"
18#include "XLXmlFile.hpp"
19
20namespace OpenXLSX
21{
25 class OPENXLSX_EXPORT XLProperties : public XLXmlFile
26 {
27 private:
31 void createFromTemplate();
32
33 public:
37 XLProperties() = default;
38
44
48 XLProperties(const XLProperties& other) = default;
49
53 XLProperties(XLProperties&& other) noexcept = default;
54
59
63 XLProperties& operator=(const XLProperties& other) = default;
64
68 XLProperties& operator=(XLProperties&& other) noexcept = default;
69
75 void setProperty(std::string_view name, std::string_view value);
76
82 void setProperty(std::string_view name, int value);
83
89 void setProperty(std::string_view name, double value);
90
96 std::string property(std::string_view name) const;
97
102 void deleteProperty(std::string_view name);
103
104 // Standard Core Properties
105 std::string title() const;
106 void setTitle(std::string_view title);
107
108 std::string subject() const;
109 void setSubject(std::string_view subject);
110
111 std::string creator() const;
112 void setCreator(std::string_view creator);
113
114 std::string keywords() const;
115 void setKeywords(std::string_view keywords);
116
117 std::string description() const;
118 void setDescription(std::string_view description);
119
120 std::string lastModifiedBy() const;
121 void setLastModifiedBy(std::string_view author);
122
123 std::string revision() const;
124 void setRevision(std::string_view revision);
125
126 std::string lastPrinted() const;
127 void setLastPrinted(std::string_view date);
128
129 XLDateTime created() const;
130 void setCreated(const XLDateTime& date);
131
132 XLDateTime modified() const;
133 void setModified(const XLDateTime& date);
134
135 std::string category() const;
136 void setCategory(std::string_view category);
137
138 std::string contentStatus() const;
139 void setContentStatus(std::string_view status);
140 };
141
145 class OPENXLSX_EXPORT XLAppProperties : public XLXmlFile
146 {
147 private:
152 void createFromTemplate(XMLDocument const& workbookXml);
153
154 public:
158 XLAppProperties() = default;
159
165 explicit XLAppProperties(XLXmlData* xmlData, XMLDocument const& workbookXml);
166
172
176 XLAppProperties(const XLAppProperties& other) = default;
177
181 XLAppProperties(XLAppProperties&& other) noexcept = default;
182
187
191 XLAppProperties& operator=(const XLAppProperties& other) = default;
192
196 XLAppProperties& operator=(XLAppProperties&& other) noexcept = default;
197
202 void incrementSheetCount(int16_t increment);
203
208 void alignWorksheets(const std::vector<std::string>& workbookSheetNames);
209
214 void addSheetName(std::string_view title);
215
220 void deleteSheetName(std::string_view title);
221
227 void setSheetName(std::string_view oldTitle, std::string_view newTitle);
228
234 void addHeadingPair(std::string_view name, int value);
235
240 void deleteHeadingPair(std::string_view name);
241
247 void setHeadingPair(std::string_view name, int newValue);
248
254 void setProperty(std::string_view name, std::string_view value);
255
261 std::string property(std::string_view name) const;
262
267 void deleteProperty(std::string_view name);
268
273 void appendSheetName(std::string_view sheetName);
274
279 void prependSheetName(std::string_view sheetName);
280
286 void insertSheetName(std::string_view sheetName, unsigned int index);
287 };
288
292 class OPENXLSX_EXPORT XLCustomProperties : public XLXmlFile
293 {
294 private:
298 void createFromTemplate();
299
300 public:
305
311
315 XLCustomProperties(const XLCustomProperties& other) = default;
316
320 XLCustomProperties(XLCustomProperties&& other) noexcept = default;
321
326
331
335 XLCustomProperties& operator=(XLCustomProperties&& other) noexcept = default;
336
342 void setProperty(std::string_view name, std::string_view value);
343
349 void setProperty(std::string_view name, const char* value);
350
356 void setProperty(std::string_view name, int value);
357
363 void setProperty(std::string_view name, double value);
364
370 void setProperty(std::string_view name, bool value);
371
377 void setProperty(std::string_view name, const XLDateTime& value);
378
384 std::string property(std::string_view name) const;
385
390 void deleteProperty(std::string_view name);
391 };
392
393} // namespace OpenXLSX
394
395#ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
396# pragma warning(pop)
397#endif // _MSC_VER
398
399#endif // OPENXLSX_XLPROPERTIES_HPP
XLXmlData * xmlData
Definition XLDocument.cpp:1422
Definition XLXmlParser.hpp:241
The XLAppProperties class represents the extended/application properties (docProps/app....
Definition XLProperties.hpp:146
XLAppProperties & operator=(XLAppProperties &&other) noexcept=default
Move assignment operator.
~XLAppProperties()
Destructor.
XLAppProperties(const XLAppProperties &other)=default
Copy constructor.
XLAppProperties & operator=(const XLAppProperties &other)=default
Copy assignment operator.
XLAppProperties()=default
Default constructor.
XLAppProperties(XLAppProperties &&other) noexcept=default
Move constructor.
The XLCustomProperties class represents custom user-defined properties (docProps/custom....
Definition XLProperties.hpp:293
XLCustomProperties(XLCustomProperties &&other) noexcept=default
Move constructor.
XLCustomProperties & operator=(const XLCustomProperties &other)=default
Copy assignment operator.
XLCustomProperties()=default
Default constructor.
XLCustomProperties & operator=(XLCustomProperties &&other) noexcept=default
Move assignment operator.
XLCustomProperties(const XLCustomProperties &other)=default
Copy constructor.
Manages date and time values according to the Excel 1900 date system.
Definition XLDateTime.hpp:30
The XLProperties class represents the core properties of the document (docProps/core....
Definition XLProperties.hpp:26
XLProperties(XLProperties &&other) noexcept=default
Move constructor.
XLProperties & operator=(const XLProperties &other)=default
Copy assignment operator.
XLProperties & operator=(XLProperties &&other) noexcept=default
Move assignment operator.
XLProperties(const XLProperties &other)=default
Copy constructor.
XLProperties()=default
Default constructor.
~XLProperties()
Destructor.
The XLXmlData class encapsulates the properties and behaviour of the .xml files in an ....
Definition XLXmlData.hpp:29
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