xlnt
streaming_workbook_writer.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 #pragma once
26 
27 #include <cstddef>
28 #include <iterator>
29 #include <string>
30 #include <vector>
31 
32 #include <xlnt/xlnt_config.hpp>
33 
34 namespace xml {
35 class serializer;
36 }
37 
38 namespace xlnt {
39 
40 class cell;
41 class cell_reference;
42 class worksheet;
43 
44 namespace detail {
45 class xlsx_producer;
46 } // namespace detail
47 
52 {
53 public:
56 
62  void close();
63 
69  cell add_cell(const cell_reference &ref);
70 
75  worksheet add_worksheet(const std::string &title);
76 
81  void open(std::vector<std::uint8_t> &data);
82 
87  void open(const std::string &filename);
88 
89 #ifdef _MSC_VER
90  void open(const std::wstring &filename);
95 #endif
96 
101  void open(const xlnt::path &filename);
102 
106  void open(std::ostream &stream);
107 
108  std::unique_ptr<xlnt::detail::xlsx_producer> producer_;
109  std::unique_ptr<workbook> workbook_;
110  std::unique_ptr<std::ostream> stream_;
111  std::unique_ptr<std::streambuf> stream_buffer_;
112  std::unique_ptr<std::ostream> part_stream_;
113  std::unique_ptr<std::streambuf> part_stream_buffer_;
114  std::unique_ptr<xml::serializer> serializer_;
115 };
116 
117 } // namespace xlnt
Enumerates the possible types a cell can be determined by it&#39;s current value.
Definition: cell.hpp:37
workbook is the container for all other parts of the document.
Definition: streaming_workbook_writer.hpp:51
A worksheet is a 2D array of cells starting with cell A1 in the top-left corner and extending indefin...
Definition: worksheet.hpp:77
Definition: spreadsheet_drawing.hpp:31
An object used to refer to a cell. References have two parts, the column and the row. In Excel, the reference string A1 refers to the top-left-most cell. A cell_reference can be initialized from a string of this form or a 1-indexed ordered pair of the form column, row.
Definition: cell_reference.hpp:60
Describes a unit of data in a worksheet at a specific coordinate and its associated properties...
Definition: cell.hpp:84
Encapsulates a path that points to location in a filesystem.
Definition: path.hpp:38