SimpleXlsx  r0.19
 All Classes Namespaces Functions Variables Enumerations Pages
SimpleXlsx::CWorkbook Class Reference

The class CWorkbook is used to manage creation, population and saving .xlsx files. More...

#include <Workbook.h>

Public Member Functions

 CWorkbook ()
 The class default constructor.
virtual ~CWorkbook ()
 The class destructor.
CWorksheetAddSheet (const _tstring &title)
 Adds another data sheet into the workbook.
CWorksheetAddSheet (const _tstring &title, std::vector< ColumnWidth > &colWidths)
 Adds another data sheet into the workbook.
CWorksheetAddSheet (const _tstring &title, uint32_t frozenWidth, uint32_t frozenHeight)
 Adds another data sheet with a frozen pane into the workbook.
CWorksheetAddSheet (const _tstring &title, uint32_t frozenWidth, uint32_t frozenHeight, std::vector< ColumnWidth > &colWidths)
 Adds another data sheet with a frozen pane into the workbook.
CChartsheetAddChart (const _tstring &title)
 Adds another chart into the workbook.
CChartsheetAddChart (const _tstring &title, EChartTypes type)
 Adds another chart into the workbook.
bool Save (const _tstring &name)
 Saves workbook into the specified file.

Private Member Functions

bool SaveCore () const
 ...
bool SaveContentType ()
 ...
bool SaveApp () const
 ...
bool SaveTheme () const
 ...
bool SaveStyles () const
 ...
bool SaveChain ()
 ...
bool SaveComments ()
 ...
bool SaveSharedStrings ()
 ...
bool SaveWorkbook () const
 ...
bool SaveCommentList (std::vector< Comment * > &comments)
 ...
void AddComment (xmlw::XmlStream &xml_stream, const Comment &comment) const
 ...
void AddCommentDrawing (xmlw::XmlStream &xml_stream, const Comment &comment) const
 ...
void AddNumberFormats (xmlw::XmlStream &stream) const
 Appends number format section into styles file.
void AddFonts (xmlw::XmlStream &stream) const
 Appends fonts section into styles file.
void AddFills (xmlw::XmlStream &stream) const
 Appends fills section into styles file.
void AddBorders (xmlw::XmlStream &stream) const
 Appends borders section into styles file.
void AddBorder (xmlw::XmlStream &stream, const TCHAR *borderName, Border::BorderItem border) const
 Appends border item section into borders set.
void ClearTemp ()
 Deletes all temporary files and directories which have been created.

Static Private Member Functions

static _tstring GetFormatCodeString (const NumFormat &fmt)
 Converts numeric format object into its string representation.
static _tstring GetFormatCodeColor (ENumericStyleColor color)
 Converts numeric format color into its string representation.

Private Attributes

_tstring m_temp_path
 path to the temporary directory (unique for a book)
std::vector< _tstring > m_contentFiles
 a series of relative file pathes to be saved inside xlsx archive
std::vector< CWorksheet * > m_worksheets
 a series of data sheets
std::vector< CChartsheet * > m_charts
 a series of chart sheets
size_t m_commLastId
 m_commLastId comments counter

Detailed Description

The class CWorkbook is used to manage creation, population and saving .xlsx files.

Constructor & Destructor Documentation

SimpleXlsx::CWorkbook::CWorkbook ( )

The class default constructor.

Returns
no
SimpleXlsx::CWorkbook::~CWorkbook ( )
virtual

The class destructor.

Returns
no

Member Function Documentation

void SimpleXlsx::CWorkbook::AddBorder ( xmlw::XmlStream &  stream,
const TCHAR *  borderName,
Border::BorderItem  border 
) const
private

Appends border item section into borders set.

Parameters
streamreference to xml stream
borderNameborder name
borderstyle set
Returns
no
void SimpleXlsx::CWorkbook::AddBorders ( xmlw::XmlStream &  stream) const
private

Appends borders section into styles file.

Parameters
streamreference to xml stream
Returns
no
CChartsheet & SimpleXlsx::CWorkbook::AddChart ( const _tstring &  title)

Adds another chart into the workbook.

Parameters
titlechart page title
Returns
Reference to a newly created object
CChartsheet & SimpleXlsx::CWorkbook::AddChart ( const _tstring &  title,
EChartTypes  type 
)

Adds another chart into the workbook.

Parameters
titlechart page title
typetype of main chart
Returns
Reference to a newly created object
void SimpleXlsx::CWorkbook::AddComment ( xmlw::XmlStream &  xml_stream,
const Comment comment 
) const
private

...

Parameters
streamreference to xml stream
commentscomment list on the sheet
Returns
Boolean result of the operation
void SimpleXlsx::CWorkbook::AddCommentDrawing ( xmlw::XmlStream &  xml_stream,
const Comment comment 
) const
private

...

Parameters
streamreference to xml stream
commentscomment list on the sheet
Returns
Boolean result of the operation
void SimpleXlsx::CWorkbook::AddFills ( xmlw::XmlStream &  stream) const
private

Appends fills section into styles file.

Parameters
streamreference to xml stream
Returns
no
void SimpleXlsx::CWorkbook::AddFonts ( xmlw::XmlStream &  stream) const
private

Appends fonts section into styles file.

Parameters
streamreference to xml stream
Returns
no
void SimpleXlsx::CWorkbook::AddNumberFormats ( xmlw::XmlStream &  stream) const
private

Appends number format section into styles file.

Parameters
streamreference to xml stream
Returns
no
CWorksheet & SimpleXlsx::CWorkbook::AddSheet ( const _tstring &  title)

Adds another data sheet into the workbook.

Parameters
titlechart page title
Returns
Reference to a newly created object
CWorksheet & SimpleXlsx::CWorkbook::AddSheet ( const _tstring &  title,
std::vector< ColumnWidth > &  colWidths 
)

Adds another data sheet into the workbook.

Parameters
titlechart page title
colWidthslist of pairs colNumber:Width
Returns
Reference to a newly created object
CWorksheet & SimpleXlsx::CWorkbook::AddSheet ( const _tstring &  title,
uint32_t  frozenWidth,
uint32_t  frozenHeight 
)

Adds another data sheet with a frozen pane into the workbook.

Parameters
titlechart page title
frozenWidthfrozen pane width (in number of cells from 0)
frozenHeightfrozen pane height (in number of cells from 0)
Returns
Reference to a newly created object
CWorksheet & SimpleXlsx::CWorkbook::AddSheet ( const _tstring &  title,
uint32_t  frozenWidth,
uint32_t  frozenHeight,
std::vector< ColumnWidth > &  colWidths 
)

Adds another data sheet with a frozen pane into the workbook.

Parameters
titlechart page title
frozenWidthfrozen pane width (in number of cells from 0)
frozenHeightfrozen pane height (in number of cells from 0)
colWidthslist of pairs colNumber:Width
Returns
Reference to a newly created object
void SimpleXlsx::CWorkbook::ClearTemp ( )
private

Deletes all temporary files and directories which have been created.

Returns
no
_tstring SimpleXlsx::CWorkbook::GetFormatCodeColor ( ENumericStyleColor  color)
staticprivate

Converts numeric format color into its string representation.

Parameters
colorcolor code
Returns
String color code
_tstring SimpleXlsx::CWorkbook::GetFormatCodeString ( const NumFormat fmt)
staticprivate

Converts numeric format object into its string representation.

Parameters
fmtreference to format to be converted
Returns
String format code
bool SimpleXlsx::CWorkbook::Save ( const _tstring &  name)

Saves workbook into the specified file.

Parameters
namefull path to the file
Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveApp ( ) const
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveChain ( )
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveCommentList ( std::vector< Comment * > &  comments)
private

...

Parameters
commentscomment list on the sheet
Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveComments ( )
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveContentType ( )
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveCore ( ) const
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveSharedStrings ( )
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveStyles ( ) const
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveTheme ( ) const
private

...

Returns
Boolean result of the operation
bool SimpleXlsx::CWorkbook::SaveWorkbook ( ) const
private

...

Returns
Boolean result of the operation

The documentation for this class was generated from the following files: