1#ifndef OPENXLSX_XLCELLRANGE_HPP
2#define OPENXLSX_XLCELLRANGE_HPP
6# pragma warning(disable : 4251)
7# pragma warning(disable : 4275)
14#include "OpenXLSX-Exports.hpp"
62 void fetchColumnStyles();
70 [[nodiscard]] std::string address()
const;
72 [[nodiscard]] uint32_t numRows()
const;
73 [[nodiscard]] uint16_t numColumns()
const;
82 void applyStyle(
const XLStyle& style);
95 std::vector<std::vector<T>> getValue()
const;
98 void setValue(
const std::vector<std::vector<T>>& matrix);
102 [[nodiscard]]
bool empty()
const;
113 typename = std::enable_if_t<
114 std::is_integral_v<T> or std::is_floating_point_v<T> or std::is_same_v<std::decay_t<T>, std::string> ||
115 std::is_same_v<std::decay_t<T>, std::string_view> or std::is_same_v<std::decay_t<T>,
const char*> ||
116 std::is_same_v<std::decay_t<T>,
char*> or std::is_same_v<T, XLDateTime>>>
119 for (
auto it = begin(); it != end(); ++it) it->value() = value;
141 std::vector<XLStyleIndex> m_columnStyles;
155 std::vector<std::vector<T>> matrix;
163 for (
auto& cell : *
this) {
164 uint32_t r = cell.cellReference().row() - startRow;
165 uint16_t c = cell.cellReference().column() - startCol;
166 matrix[r][c] = cell.value().get<T>();
174 if (matrix.empty() || matrix[0].empty())
return;
179 for (
auto& cell : *
this) {
180 uint32_t r = cell.cellReference().row() - startRow;
181 uint16_t c = cell.cellReference().column() - startCol;
182 if (r < matrix.size() && c < matrix[r].size()) { cell.value() = matrix[r][c]; }
Definition XLXmlParser.hpp:84
A forward iterator for iterating over a range of cells.
Definition XLCellIterator.hpp:37
Represents a rectangular area of cells within a worksheet.
Definition XLCellRange.hpp:30
XLCellReference topLeft() const
Definition XLCellRange.cpp:80
uint32_t numRows() const
Definition XLCellRange.cpp:99
uint16_t numColumns() const
Definition XLCellRange.cpp:108
void setValue(const std::vector< std::vector< T > > &matrix)
Definition XLCellRange.hpp:172
XLCellRange(XLCellRange &&other) noexcept=default
XLCellRange(const XLCellRange &other)=default
std::vector< std::vector< T > > getValue() const
Read the range into a 2D matrix of type T.
Definition XLCellRange.hpp:153
XLCellRange & operator=(XLCellRange &&other) noexcept=default
XLCellRange & operator=(const XLCellRange &other)=default
XLCellRange & operator=(T value)
Assigns a single value to every cell in the range.
Definition XLCellRange.hpp:117
Definition XLCellReference.hpp:34
uint32_t row() const noexcept
Get the row number of the XLCellReference.
Definition XLCellReference.cpp:146
uint16_t column() const noexcept
Get the column number of the XLCellReference.
Definition XLCellReference.cpp:163
Definition XLColor.hpp:22
This class encapsulate the Excel concept of Shared Strings. In Excel, instead of havig individual str...
Definition XLSharedStrings.hpp:67
Definition IZipArchive.hpp:18
size_t XLStyleIndex
Definition XLStyles.hpp:31
XLLineStyle
Definition XLStyles.hpp:149
std::reference_wrapper< const XLSharedStrings > XLSharedStringsRef
Definition XLSharedStrings.hpp:56
A high-level, human-ergonomic structure representing the styling of a cell or range....
Definition XLStyle.hpp:19