1 #ifndef __WORKSHEET_H__
2 #define __WORKSHEET_H__
4 #include "../xmlwriter.h"
6 int32_t _stprintf(TCHAR *buffer,
const TCHAR *format, ...);
15 enum EPageOrientation {
44 CWorksheet(uint32_t index,
const _tstring& temp_path);
45 CWorksheet(uint32_t index, std::vector<ColumnWidth>& colHeights,
const _tstring& temp_path);
46 CWorksheet(uint32_t index, uint32_t width, uint32_t height,
const _tstring& temp_path);
47 CWorksheet(uint32_t index, uint32_t width, uint32_t height, std::vector<ColumnWidth>& colHeights,
const _tstring& temp_path);
53 int32_t GetIndex()
const {
return m_index; }
54 void GetCalcChain(std::vector<_tstring>& chain)
const{ chain =
m_calcChain; }
55 void SetSharedStr(std::map<_tstring, uint64_t>* share) {
m_sharedStrings = share; }
56 void SetComments(std::vector<Comment>* share) {
m_comments = share; }
59 _tstring GetTitle()
const {
return m_title; }
60 void SetTitle(
const _tstring& title) {
m_title = title.length() > 31 ? title.substr(0, 31) : title; }
62 void AddComment(
const Comment& comment) {
74 void AddCell(
const CellDataStr& data);
75 void AddCells(
const std::vector<CellDataStr>& data);
76 void AddCell(
const CellDataTime& data);
77 void AddCells(
const std::vector<CellDataTime>& data);
78 void AddCell(
const CellDataInt& data);
79 void AddCells(
const std::vector<CellDataInt>& data);
80 void AddCell(
const CellDataUInt& data);
81 void AddCells(
const std::vector<CellDataUInt>& data);
82 void AddCell(
const CellDataDbl& data);
83 void AddCells(
const std::vector<CellDataDbl>& data);
84 void AddCell(
const CellDataFlt& data);
85 void AddCells(
const std::vector<CellDataFlt>& data);
88 void AddRow(
const std::vector<CellDataStr>& data, uint32_t offset = 0, uint32_t height = 0);
89 void AddRow(
const std::vector<CellDataTime>& data, uint32_t offset = 0, uint32_t height = 0);
90 void AddRow(
const std::vector<CellDataInt>& data, uint32_t offset = 0, uint32_t height = 0);
91 void AddRow(
const std::vector<CellDataUInt>& data, uint32_t offset = 0, uint32_t height = 0);
92 void AddRow(
const std::vector<CellDataDbl>& data, uint32_t offset = 0, uint32_t height = 0);
93 void AddRow(
const std::vector<CellDataFlt>& data, uint32_t offset = 0, uint32_t height = 0);
95 void MergeCells(CellCoord cellFrom, CellCoord cellTo);
99 bool IsOk()
const {
return m_isOk; }
102 static void GetCellCoord(CellCoord cell, TCHAR *szCoord);
105 void Init(uint32_t index, uint32_t frozenWidth, uint32_t frozenHeight, std::vector<ColumnWidth>& colHeights);
123 using namespace xmlw;
125 TCHAR szCoord[15] = { 0 };
127 (*m_xmlStream) << tag(_T(
"c")) << attr(_T(
"r")) << szCoord;
130 (*m_xmlStream) << attr(_T(
"s")) << style;
134 << tag(_T(
"v")) << chardata() << data << endtag()
147 using namespace xmlw;
150 (*m_xmlStream) << endtag();
152 (*m_xmlStream) << tag(_T(
"row")) << attr(_T(
"r")) << ++
m_row_index << attr(_T(
"x14ac:dyDescent")) << 0.25;
154 (*m_xmlStream) << attr(_T(
"ht")) << height << attr(_T(
"customHeight")) << 1;
168 for (
size_t i = 0; i < data.size(); i++)
179 for (
size_t i = 0; i < data.size(); i++)
189 using namespace xmlw;
192 (*m_xmlStream) << endtag();
199 #endif // __WORKSHEET_H__