SimpleXlsx
r0.19
|
The class CWorksheet is used for creation and population .xlsx file sheet table with data. More...
#include <Worksheet.h>
Public Member Functions | |
CWorksheet () | |
The class default constructor. | |
CWorksheet (uint32_t index, const _tstring &temp_path) | |
The class constructor. | |
CWorksheet (uint32_t index, std::vector< ColumnWidth > &colHeights, const _tstring &temp_path) | |
The class constructor. | |
CWorksheet (uint32_t index, uint32_t width, uint32_t height, const _tstring &temp_path) | |
The class constructor to create sheet with frozen pane. | |
CWorksheet (uint32_t index, uint32_t width, uint32_t height, std::vector< ColumnWidth > &colHeights, const _tstring &temp_path) | |
The class constructor to create sheet with frozen pane. | |
virtual | ~CWorksheet () |
The class destructor (virtual) | |
void | BeginRow (uint32_t height=0) |
Generates a header for another row. | |
void | AddCell (const CellDataStr &data) |
Add string-formatted cell with specified style. | |
void | AddCells (const std::vector< CellDataStr > &data) |
Adds a group of cells into a row. | |
void | AddCell (const CellDataTime &data) |
Add time-formatted cell with specified style. | |
void | AddCells (const std::vector< CellDataTime > &data) |
Adds a group of cells into a row. | |
void | EndRow () |
Closes previously began row. | |
void | AddRow (const std::vector< CellDataStr > &data, uint32_t offset=0, uint32_t height=0) |
Appends another row into the sheet. | |
void | AddRow (const std::vector< CellDataTime > &data, uint32_t offset=0, uint32_t height=0) |
Appends another row into the sheet. | |
void | AddRow (const std::vector< CellDataInt > &data, uint32_t offset=0, uint32_t height=0) |
Appends another row into the sheet. | |
void | AddRow (const std::vector< CellDataUInt > &data, uint32_t offset=0, uint32_t height=0) |
Appends another row into the sheet. | |
void | AddRow (const std::vector< CellDataDbl > &data, uint32_t offset=0, uint32_t height=0) |
Appends another row into the sheet. | |
void | AddRow (const std::vector< CellDataFlt > &data, uint32_t offset=0, uint32_t height=0) |
Appends another row into the sheet. | |
void | MergeCells (CellCoord cellFrom, CellCoord cellTo) |
Appends merged cells range into the sheet. | |
void | GetCurrentCellCoord (CellCoord &currCell) |
Receives next to write cell`s coordinates. | |
bool | Save () |
Saves current xml document into a file with preset name. |
Static Public Member Functions | |
static void | GetCellCoord (CellCoord cell, TCHAR *szCoord) |
Transforms the row and the column numerics from int32_t to coordinate string format. |
Private Member Functions | |
void | Init (uint32_t index, uint32_t frozenWidth, uint32_t frozenHeight, std::vector< ColumnWidth > &colHeights) |
Initializes internal variables and creates a header of a sheet xml tree. | |
void | AddFrozenPane (uint32_t width, uint32_t height) |
Internal initializatino method adds frozen pane`s information into sheet. | |
template<typename T > | |
void | AddCellRoutine (T data, int32_t style) |
Appends another a group of cells into a row. | |
bool | SaveCommentsRels () |
Saves current sheet relations file. |
Private Attributes | |
_tofstream * | m_f |
stl output file stream is used for xml writing | |
xmlw::XmlStream * | m_xmlStream |
xml output stream | |
std::vector< _tstring > | m_calcChain |
list of cells with formulae | |
std::map< _tstring, uint64_t > * | m_sharedStrings |
pointer to the list of string supposed to be into shared area | |
std::vector< Comment > * | m_comments |
pointer to the list of comments | |
std::vector< _tstring > | m_mergedCells |
list of merged cells` ranges (e.g. A1:B2) | |
int32_t | m_index |
current sheet number | |
_tstring | m_temp_path |
path to the temporary directory (unique for a book) | |
_tstring | m_title |
page title | |
bool | m_withFormula |
indicates whether the sheet contains formulae | |
bool | m_withComments |
indicates whether the sheet contains any comments | |
bool | m_isOk |
indicates initialization successfulness | |
bool | m_isDataPresented |
indicates whether the sheet contains a data | |
int32_t | m_row_index |
since data add row-by-row it contains current row to write | |
bool | m_row_opened |
indicates whether row tag is opened | |
int32_t | m_current_column |
used at separate row generation - last cell column number to be added | |
int32_t | m_offset_column |
used at entire row addition (implicit parameter for AddCell method) | |
EPageOrientation | m_page_orientation |
defines page orientation for printing |
The class CWorksheet is used for creation and population .xlsx file sheet table with data.
SimpleXlsx::CWorksheet::CWorksheet | ( | ) |
The class default constructor.
SimpleXlsx::CWorksheet::CWorksheet | ( | uint32_t | index, |
const _tstring & | temp_path | ||
) |
The class constructor.
index | index of a sheet to be created (for example, sheet1.xml) |
temp_path | path to the temporary directory where sheet files must be created |
SimpleXlsx::CWorksheet::CWorksheet | ( | uint32_t | index, |
std::vector< ColumnWidth > & | colWidths, | ||
const _tstring & | temp_path | ||
) |
The class constructor.
index | index of a sheet to be created (for example, sheet1.xml) |
colWidths | list of pairs colNumber:Width |
temp_path | path to the temporary directory where sheet files must be created |
SimpleXlsx::CWorksheet::CWorksheet | ( | uint32_t | index, |
uint32_t | width, | ||
uint32_t | height, | ||
const _tstring & | temp_path | ||
) |
The class constructor to create sheet with frozen pane.
index | index of a sheet to be created (for example, sheet1.xml) |
width | frozen pane with |
height | frozen pane height |
temp_path | path to the temporary directory where sheet files must be created |
SimpleXlsx::CWorksheet::CWorksheet | ( | uint32_t | index, |
uint32_t | width, | ||
uint32_t | height, | ||
std::vector< ColumnWidth > & | colWidths, | ||
const _tstring & | temp_path | ||
) |
The class constructor to create sheet with frozen pane.
index | index of a sheet to be created (for example, sheet1.xml) |
width | frozen pane with |
height | frozen pane height |
colWidths | list of pairs colNumber:Width |
temp_path | path to the temporary directory where sheet files must be created |
|
virtual |
The class destructor (virtual)
void SimpleXlsx::CWorksheet::AddCell | ( | const CellDataStr & | data | ) |
Add string-formatted cell with specified style.
data | reference to data |
void SimpleXlsx::CWorksheet::AddCell | ( | const CellDataTime & | data | ) |
Add time-formatted cell with specified style.
data | reference to data |
|
private |
Appends another a group of cells into a row.
data | template data value |
style | style index |
|
inline |
Adds a group of cells into a row.
data | reference to the vector of pairs <string, style_index> |
|
inline |
Adds a group of cells into a row.
data | reference to the vector of pairs <time_t, style_index> |
|
private |
Internal initializatino method adds frozen pane`s information into sheet.
width | frozen pane width (in number of cells) |
height | frozen pane height (in number of cells) |
void SimpleXlsx::CWorksheet::AddRow | ( | const std::vector< CellDataStr > & | data, |
uint32_t | offset = 0 , |
||
uint32_t | height = 0 |
||
) |
Appends another row into the sheet.
data | reference to the vector of pairs <string, style> |
offset | the offset from the row begining (0 by default) |
height | row height (deafult if 0) |
void SimpleXlsx::CWorksheet::AddRow | ( | const std::vector< CellDataTime > & | data, |
uint32_t | offset = 0 , |
||
uint32_t | height = 0 |
||
) |
Appends another row into the sheet.
data | reference to the vector of pairs <string, style> |
offset | the offset from the row begining (0 by default) |
height | row height (deafult if 0) |
void SimpleXlsx::CWorksheet::AddRow | ( | const std::vector< CellDataInt > & | data, |
uint32_t | offset = 0 , |
||
uint32_t | height = 0 |
||
) |
Appends another row into the sheet.
data | reference to the vector of pairs <int32_t, style> |
offset | the offset from the row begining (0 by default) |
height | row height (deafult if 0) |
void SimpleXlsx::CWorksheet::AddRow | ( | const std::vector< CellDataUInt > & | data, |
uint32_t | offset = 0 , |
||
uint32_t | height = 0 |
||
) |
Appends another row into the sheet.
data | reference to the vector of pairs <uint32_t, style> |
offset | the offset from the row begining (0 by default) |
height | row height (deafult if 0) |
void SimpleXlsx::CWorksheet::AddRow | ( | const std::vector< CellDataDbl > & | data, |
uint32_t | offset = 0 , |
||
uint32_t | height = 0 |
||
) |
Appends another row into the sheet.
data | reference to the vector of pairs <double, style> |
offset | the offset from the row begining (0 by default) |
height | row height (deafult if 0) |
void SimpleXlsx::CWorksheet::AddRow | ( | const std::vector< CellDataFlt > & | data, |
uint32_t | offset = 0 , |
||
uint32_t | height = 0 |
||
) |
Appends another row into the sheet.
data | reference to the vector of pairs <float, style> |
offset | the offset from the row begining (0 by default) |
height | row height (deafult if 0) |
|
inline |
Generates a header for another row.
height | row height (default if 0) |
|
inline |
Closes previously began row.
|
static |
Transforms the row and the column numerics from int32_t to coordinate string format.
cell | (row value from 1, col value from 0) |
szCoord | output parameter to be filled (pointer must be valid) |
void SimpleXlsx::CWorksheet::GetCurrentCellCoord | ( | CellCoord & | currCell | ) |
Receives next to write cell`s coordinates.
currCell | (row value from 1, col value from 0) |
|
private |
Initializes internal variables and creates a header of a sheet xml tree.
index | index of a sheet to be created (for example, sheet1.xml) |
frozenWidth | frozen pane with |
frozenHeight | frozen pane height |
colWidths | list of pairs colNumber:Width |
Appends merged cells range into the sheet.
cellFrom | (row value from 1, col value from 0) |
cellTo | (row value from 1, col value from 0) |
bool SimpleXlsx::CWorksheet::Save | ( | ) |
Saves current xml document into a file with preset name.
|
private |
Saves current sheet relations file.