// Copyright (c) 2014-2021 Thomas Fussell // Copyright (c) 2010-2015 openpyxl // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE // // @license: http://www.opensource.org/licenses/mit-license.php // @author: see AUTHORS file #pragma once #include #include #include #include #include namespace xml { class serializer; } namespace xlnt { class cell; class cell_reference; class worksheet; namespace detail { class xlsx_producer; } // namespace detail /// /// workbook is the container for all other parts of the document. /// class XLNT_API streaming_workbook_writer { public: streaming_workbook_writer(); ~streaming_workbook_writer(); /// /// Finishes writing of the remaining contents of the workbook and closes /// currently open write stream. This will be called automatically by the /// destructor if it hasn't already been called manually. /// void close(); /// /// Writes a cell to the currently active worksheet at the position given by /// ref and with the given value. ref should be to the right of or below /// the previously written cell. /// cell add_cell(const cell_reference &ref); /// /// Ends writing of data to the current sheet and begins writing a new sheet /// with the given title. /// worksheet add_worksheet(const std::string &title); /// /// Serializes the workbook into an XLSX file and saves the bytes into /// byte vector data. /// void open(std::vector &data); /// /// Serializes the workbook into an XLSX file and saves the data into a file /// named filename. /// void open(const std::string &filename); #ifdef _MSC_VER /// /// Serializes the workbook into an XLSX file and saves the data into a file /// named filename. /// void open(const std::wstring &filename); #endif /// /// Serializes the workbook into an XLSX file and saves the data into a file /// named filename. /// void open(const xlnt::path &filename); /// /// Serializes the workbook into an XLSX file and saves the data into stream. /// void open(std::ostream &stream); std::unique_ptr producer_; std::unique_ptr workbook_; std::unique_ptr stream_; std::unique_ptr stream_buffer_; std::unique_ptr part_stream_; std::unique_ptr part_stream_buffer_; std::unique_ptr serializer_; }; } // namespace xlnt