xlnt
page_setup.hpp
1 // Copyright (c) 2014-2022 Thomas Fussell
2 // Copyright (c) 2010-2015 openpyxl
3 // Copyright (c) 2024 xlnt-community
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE
22 //
23 // @license: http://www.opensource.org/licenses/mit-license.php
24 // @author: see AUTHORS file
25 
26 #pragma once
27 
28 #include <xlnt/xlnt_config.hpp>
29 #include <xlnt/utils/optional.hpp>
30 
31 namespace xlnt {
32 
36 enum class XLNT_API orientation
37 {
38  default_orientation,
39  portrait,
40  landscape
41 };
42 
46 enum class XLNT_API page_break
47 {
48  none = 0,
49  row = 1,
50  column = 2
51 };
52 
56 enum class XLNT_API paper_size
57 {
58  letter = 1,
59  letter_small = 2,
60  tabloid = 3,
61  ledger = 4,
62  legal = 5,
63  statement = 6,
64  executive = 7,
65  a3 = 8,
66  a4 = 9,
67  a4_small = 10,
68  a5 = 11
69 };
70 
75 enum class XLNT_API sheet_state
76 {
77  visible,
78  hidden,
79  very_hidden
80 };
81 
85 struct XLNT_API page_setup
86 {
87 public:
91  page_setup();
92 
97 
102 
107 
111  void sheet_state(xlnt::sheet_state sheet_state);
112 
117 
121  void paper_size(xlnt::paper_size paper_size);
122 
126  bool has_paper_size() const;
127 
131  bool fit_to_page() const;
132 
136  void fit_to_page(bool fit_to_page);
137 
141  bool fit_to_height() const;
142 
146  void fit_to_height(bool fit_to_height);
147 
151  bool fit_to_width() const;
152 
156  void fit_to_width(bool fit_to_width);
157 
161  void scale(double scale);
162 
166  double scale() const;
167 
171  bool has_scale() const;
172 
176  const std::string& rel_id() const;
177 
181  void rel_id(const std::string& val);
182 
186  bool has_rel_id() const;
187 
200 
201  bool operator==(const page_setup &rhs) const;
202 
203 private:
207  std::string rel_id_;
208 
212  xlnt::page_break break_;
213 
217  xlnt::sheet_state sheet_state_;
218 
223 
227  bool fit_to_page_;
228 
232  bool fit_to_height_;
233 
237  bool fit_to_width_;
238 
242  xlnt::optional<double> scale_;
243 };
244 
245 } // namespace xlnt
orientation
The orientation of the worksheet when it is printed.
Definition: page_setup.hpp:36
xlnt::optional< std::size_t > horizontal_dpi_
The horizontal dpi
Definition: page_setup.hpp:195
Enumerates the possible types a cell can be determined by it&#39;s current value.
Definition: cell.hpp:37
bool operator==(std::nullptr_t, const cell &cell)
Returns true if this cell is uninitialized.
paper_size
The possible paper sizes for printing.
Definition: page_setup.hpp:56
sheet_state
Defines how a worksheet appears in the workbook. A workbook must have at least one sheet which is vis...
Definition: page_setup.hpp:75
xlnt::optional< std::size_t > vertical_dpi_
The vertical dpi
Definition: page_setup.hpp:199
Describes how a worksheet will be converted into a page during printing.
Definition: page_setup.hpp:85
xlnt::optional< xlnt::orientation > orientation_
The orientation
Definition: page_setup.hpp:191
page_break
The types of page breaks.
Definition: page_setup.hpp:46