NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
YExcel::BasicExcel Class Reference

#include <BasicExcel.hpp>

Collaboration diagram for YExcel::BasicExcel:

Public Member Functions

 BasicExcel ()
 
 BasicExcel (const char *filename)
 
 ~BasicExcel ()
 
void New (int sheets=3)
 Create a new Excel workbook with a given number of spreadsheets (Minimum 1). More...
 
bool Load (const char *filename)
 Load an Excel workbook from a file. More...
 
bool Save ()
 Save current Excel workbook to opened file. More...
 
bool SaveAs (const char *filename)
 Save current Excel workbook to a file. More...
 
size_t GetTotalWorkSheets ()
 Total number of Excel worksheets in current Excel workbook. More...
 
BasicExcelWorksheetGetWorksheet (size_t sheetIndex)
 Get a pointer to an Excel worksheet at the given index. Index starts from 0. Returns 0 if index is invalid. More...
 
BasicExcelWorksheetGetWorksheet (const char *name)
 Get a pointer to an Excel worksheet that has given ANSI name. Returns 0 if there is no Excel worksheet with the given name. More...
 
BasicExcelWorksheetGetWorksheet (const wchar_t *name)
 Get a pointer to an Excel worksheet that has given Unicode name. Returns 0 if there is no Excel worksheet with the given name. More...
 
BasicExcelWorksheetAddWorksheet (int sheetIndex=-1)
 Add a new Excel worksheet to the given index. Name given to worksheet is SheetX, where X is a number which starts from 1. Index starts from 0. Worksheet is added to the last position if sheetIndex == -1. Returns a pointer to the worksheet if successful, 0 if otherwise. More...
 
BasicExcelWorksheetAddWorksheet (const char *name, int sheetIndex=-1)
 Add a new Excel worksheet with given ANSI name to the given index. Index starts from 0. Worksheet is added to the last position if sheetIndex == -1. Returns a pointer to the worksheet if successful, 0 if otherwise. More...
 
BasicExcelWorksheetAddWorksheet (const wchar_t *name, int sheetIndex=-1)
 Add a new Excel worksheet with given Unicode name to the given index. Index starts from 0. Worksheet is added to the last position if sheetIndex == -1. Returns a pointer to the worksheet if successful, 0 if otherwise. More...
 
bool DeleteWorksheet (size_t sheetIndex)
 Delete an Excel worksheet at the given index. Index starts from 0. Returns true if successful, false if otherwise. More...
 
bool DeleteWorksheet (const char *name)
 Delete an Excel worksheet that has given ANSI name. Returns true if successful, false if otherwise. More...
 
bool DeleteWorksheet (const wchar_t *name)
 Delete an Excel worksheet that has given Unicode name. Returns true if successful, false if otherwise. More...
 
char * GetAnsiSheetName (size_t sheetIndex)
 Get the worksheet name at the given index. Index starts from 0. Returns 0 if name is in Unicode format. More...
 
wchar_t * GetUnicodeSheetName (size_t sheetIndex)
 Get the worksheet name at the given index. Index starts from 0. Returns 0 if name is in Ansi format. More...
 
bool GetSheetName (size_t sheetIndex, char *name)
 Get the worksheet name at the given index. Index starts from 0. Returns false if name is in Unicode format. More...
 
bool GetSheetName (size_t sheetIndex, wchar_t *name)
 Get the worksheet name at the given index. Index starts from 0. Returns false if name is in Ansi format. More...
 
bool RenameWorksheet (size_t sheetIndex, const char *to)
 Rename an Excel worksheet at the given index to the given ANSI name. Index starts from 0. Returns true if successful, false if otherwise. More...
 
bool RenameWorksheet (size_t sheetIndex, const wchar_t *to)
 Rename an Excel worksheet at the given index to the given Unicode name. Index starts from 0. Returns true if successful, false if otherwise. More...
 
bool RenameWorksheet (const char *from, const char *to)
 Rename an Excel worksheet that has given ANSI name to another ANSI name. Returns true if successful, false if otherwise. More...
 
bool RenameWorksheet (const wchar_t *from, const wchar_t *to)
 Rename an Excel worksheet that has given Unicode name to another Unicode name. Returns true if successful, false if otherwise. More...
 

Public Attributes

CompoundFile file_
 Compound file handler. More...
 
Workbook workbook_
 Raw Workbook. More...
 
std::vector< Worksheetworksheets_
 Raw Worksheets. More...
 
std::vector< BasicExcelWorksheetyesheets_
 Parsed Worksheets. More...
 

Private Types

enum  { WORKBOOK_GLOBALS =0x0005 , VISUAL_BASIC_MODULE =0x0006 , WORKSHEET =0x0010 , CHART =0x0020 }
 

Private Member Functions

size_t Read (const char *data, size_t dataSize)
 
size_t Write (char *data)
 
void AdjustStreamPositions ()
 
void AdjustBoundSheetBOFPositions ()
 
void AdjustDBCellPositions ()
 
void AdjustExtSSTPositions ()
 
void UpdateYExcelWorksheet ()
 Update yesheets_ using information from worksheets_. More...
 
void UpdateWorksheets ()
 Update worksheets_ using information from yesheets_. More...
 

Detailed Description

Definition at line 1112 of file BasicExcel.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
WORKBOOK_GLOBALS 
VISUAL_BASIC_MODULE 
WORKSHEET 
CHART 

Definition at line 1158 of file BasicExcel.hpp.

Constructor & Destructor Documentation

◆ BasicExcel() [1/2]

YExcel::BasicExcel::BasicExcel ( )

Definition at line 4466 of file BasicExcel.cpp.

◆ BasicExcel() [2/2]

YExcel::BasicExcel::BasicExcel ( const char *  filename)

Definition at line 4467 of file BasicExcel.cpp.

◆ ~BasicExcel()

YExcel::BasicExcel::~BasicExcel ( )

Definition at line 4472 of file BasicExcel.cpp.

Member Function Documentation

◆ AddWorksheet() [1/3]

BasicExcelWorksheet * YExcel::BasicExcel::AddWorksheet ( const char *  name,
int  sheetIndex = -1 
)

Add a new Excel worksheet with given ANSI name to the given index. Index starts from 0. Worksheet is added to the last position if sheetIndex == -1. Returns a pointer to the worksheet if successful, 0 if otherwise.

Definition at line 4612 of file BasicExcel.cpp.

References name, YExcel::Workbook::BoundSheet::name_, YExcel::Worksheet::Window2::options_, YExcel::BasicExcelWorksheet::sheetIndex_, YExcel::Worksheet::window2_, and YExcel::Worksheet::Worksheet().

Here is the call graph for this function:

◆ AddWorksheet() [2/3]

BasicExcelWorksheet * YExcel::BasicExcel::AddWorksheet ( const wchar_t *  name,
int  sheetIndex = -1 
)

Add a new Excel worksheet with given Unicode name to the given index. Index starts from 0. Worksheet is added to the last position if sheetIndex == -1. Returns a pointer to the worksheet if successful, 0 if otherwise.

Definition at line 4653 of file BasicExcel.cpp.

References name, YExcel::Workbook::BoundSheet::name_, YExcel::Worksheet::Window2::options_, YExcel::BasicExcelWorksheet::sheetIndex_, YExcel::Worksheet::window2_, and YExcel::Worksheet::Worksheet().

Here is the call graph for this function:

◆ AddWorksheet() [3/3]

BasicExcelWorksheet * YExcel::BasicExcel::AddWorksheet ( int  sheetIndex = -1)

Add a new Excel worksheet to the given index. Name given to worksheet is SheetX, where X is a number which starts from 1. Index starts from 0. Worksheet is added to the last position if sheetIndex == -1. Returns a pointer to the worksheet if successful, 0 if otherwise.

Definition at line 4595 of file BasicExcel.cpp.

◆ AdjustBoundSheetBOFPositions()

void YExcel::BasicExcel::AdjustBoundSheetBOFPositions ( )
private

Definition at line 4922 of file BasicExcel.cpp.

◆ AdjustDBCellPositions()

void YExcel::BasicExcel::AdjustDBCellPositions ( )
private

◆ AdjustExtSSTPositions()

void YExcel::BasicExcel::AdjustExtSSTPositions ( )
private

Definition at line 4995 of file BasicExcel.cpp.

◆ AdjustStreamPositions()

void YExcel::BasicExcel::AdjustStreamPositions ( )
private

Definition at line 4915 of file BasicExcel.cpp.

◆ DeleteWorksheet() [1/3]

bool YExcel::BasicExcel::DeleteWorksheet ( const char *  name)

Delete an Excel worksheet that has given ANSI name. Returns true if successful, false if otherwise.

Definition at line 4707 of file BasicExcel.cpp.

References name.

◆ DeleteWorksheet() [2/3]

bool YExcel::BasicExcel::DeleteWorksheet ( const wchar_t *  name)

Delete an Excel worksheet that has given Unicode name. Returns true if successful, false if otherwise.

Definition at line 4720 of file BasicExcel.cpp.

References name.

◆ DeleteWorksheet() [3/3]

bool YExcel::BasicExcel::DeleteWorksheet ( size_t  sheetIndex)

Delete an Excel worksheet at the given index. Index starts from 0. Returns true if successful, false if otherwise.

Definition at line 4693 of file BasicExcel.cpp.

◆ GetAnsiSheetName()

char * YExcel::BasicExcel::GetAnsiSheetName ( size_t  sheetIndex)

Get the worksheet name at the given index. Index starts from 0. Returns 0 if name is in Unicode format.

Definition at line 4734 of file BasicExcel.cpp.

◆ GetSheetName() [1/2]

bool YExcel::BasicExcel::GetSheetName ( size_t  sheetIndex,
char *  name 
)

Get the worksheet name at the given index. Index starts from 0. Returns false if name is in Unicode format.

Definition at line 4758 of file BasicExcel.cpp.

References name.

◆ GetSheetName() [2/2]

bool YExcel::BasicExcel::GetSheetName ( size_t  sheetIndex,
wchar_t *  name 
)

Get the worksheet name at the given index. Index starts from 0. Returns false if name is in Ansi format.

Definition at line 4771 of file BasicExcel.cpp.

References name.

◆ GetTotalWorkSheets()

size_t YExcel::BasicExcel::GetTotalWorkSheets ( )

Total number of Excel worksheets in current Excel workbook.

Definition at line 4551 of file BasicExcel.cpp.

Referenced by NumeRe::XLSSpreadSheet::readFile().

◆ GetUnicodeSheetName()

wchar_t * YExcel::BasicExcel::GetUnicodeSheetName ( size_t  sheetIndex)

Get the worksheet name at the given index. Index starts from 0. Returns 0 if name is in Ansi format.

Definition at line 4746 of file BasicExcel.cpp.

◆ GetWorksheet() [1/3]

BasicExcelWorksheet * YExcel::BasicExcel::GetWorksheet ( const char *  name)

Get a pointer to an Excel worksheet that has given ANSI name. Returns 0 if there is no Excel worksheet with the given name.

Definition at line 4566 of file BasicExcel.cpp.

References name.

◆ GetWorksheet() [2/3]

BasicExcelWorksheet * YExcel::BasicExcel::GetWorksheet ( const wchar_t *  name)

Get a pointer to an Excel worksheet that has given Unicode name. Returns 0 if there is no Excel worksheet with the given name.

Definition at line 4579 of file BasicExcel.cpp.

References name.

◆ GetWorksheet() [3/3]

BasicExcelWorksheet * YExcel::BasicExcel::GetWorksheet ( size_t  sheetIndex)

Get a pointer to an Excel worksheet at the given index. Index starts from 0. Returns 0 if index is invalid.

Definition at line 4559 of file BasicExcel.cpp.

Referenced by NumeRe::XLSSpreadSheet::readFile(), and NumeRe::XLSSpreadSheet::writeFile().

◆ Load()

bool YExcel::BasicExcel::Load ( const char *  filename)

Load an Excel workbook from a file.

Definition at line 4494 of file BasicExcel.cpp.

References YExcel::Worksheet::Read().

Referenced by NumeRe::XLSSpreadSheet::readFile().

Here is the call graph for this function:

◆ New()

void YExcel::BasicExcel::New ( int  sheets = 3)

Create a new Excel workbook with a given number of spreadsheets (Minimum 1).

Definition at line 4478 of file BasicExcel.cpp.

Referenced by NumeRe::XLSSpreadSheet::writeFile().

◆ Read()

size_t YExcel::BasicExcel::Read ( const char *  data,
size_t  dataSize 
)
private

Definition at line 4863 of file BasicExcel.cpp.

References YExcel::CODE::BOF, YCompoundFiles::LittleEndian::Read(), YExcel::Record::Read(), YExcel::BOF::Read(), YExcel::BOF::type_, and YExcel::Worksheet::Worksheet().

Here is the call graph for this function:

◆ RenameWorksheet() [1/4]

bool YExcel::BasicExcel::RenameWorksheet ( const char *  from,
const char *  to 
)

Rename an Excel worksheet that has given ANSI name to another ANSI name. Returns true if successful, false if otherwise.

Definition at line 4821 of file BasicExcel.cpp.

◆ RenameWorksheet() [2/4]

bool YExcel::BasicExcel::RenameWorksheet ( const wchar_t *  from,
const wchar_t *  to 
)

Rename an Excel worksheet that has given Unicode name to another Unicode name. Returns true if successful, false if otherwise.

Definition at line 4843 of file BasicExcel.cpp.

◆ RenameWorksheet() [3/4]

bool YExcel::BasicExcel::RenameWorksheet ( size_t  sheetIndex,
const char *  to 
)

Rename an Excel worksheet at the given index to the given ANSI name. Index starts from 0. Returns true if successful, false if otherwise.

Definition at line 4784 of file BasicExcel.cpp.

Referenced by NumeRe::XLSSpreadSheet::writeFile().

◆ RenameWorksheet() [4/4]

bool YExcel::BasicExcel::RenameWorksheet ( size_t  sheetIndex,
const wchar_t *  to 
)

Rename an Excel worksheet at the given index to the given Unicode name. Index starts from 0. Returns true if successful, false if otherwise.

Definition at line 4803 of file BasicExcel.cpp.

◆ Save()

bool YExcel::BasicExcel::Save ( )

Save current Excel workbook to opened file.

Definition at line 4512 of file BasicExcel.cpp.

References YCompoundFiles::CompoundFile::SUCCESS, and YExcel::Worksheet::Write().

Here is the call graph for this function:

◆ SaveAs()

bool YExcel::BasicExcel::SaveAs ( const char *  filename)

Save current Excel workbook to a file.

Definition at line 4540 of file BasicExcel.cpp.

References YCompoundFiles::CompoundFile::SUCCESS.

Referenced by NumeRe::XLSSpreadSheet::writeFile().

◆ UpdateWorksheets()

void YExcel::BasicExcel::UpdateWorksheets ( )
private

Update worksheets_ using information from yesheets_.

Definition at line 5095 of file BasicExcel.cpp.

References YExcel::CanStoreAsRKValue(), YExcel::Worksheet::CellTable::RowBlock::CellBlock::LabelSST::colIndex_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::Number::colIndex_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::RK::colIndex_, YExcel::Worksheet::CellTable::RowBlock::dbcell_, YExcel::Worksheet::dimensions_, YExcel::BasicExcelCell::DOUBLE, YExcel::Worksheet::CellTable::RowBlock::CellBlock::MulRK::firstColIndex_, YExcel::Worksheet::Index::firstUnusedRowIndex_, YExcel::Worksheet::Dimensions::firstUsedColIndex_, YExcel::Worksheet::Index::firstUsedRowIndex_, YExcel::BasicExcelCell::Get(), YExcel::BasicExcelCell::GetDouble(), YExcel::BasicExcelCell::GetInteger(), YExcel::GetRKValueFromDouble(), YExcel::GetRKValueFromInteger(), YExcel::BasicExcelCell::GetStringLength(), YExcel::Worksheet::index_, YExcel::BasicExcelCell::INT, YExcel::CODE::LABELSST, YExcel::Worksheet::CellTable::RowBlock::CellBlock::labelsst_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::MulRK::lastColIndex_, YExcel::CODE::MULRK, YExcel::Worksheet::CellTable::RowBlock::CellBlock::mulrk_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::normalType_, YExcel::CODE::NUMBER, YExcel::Worksheet::CellTable::RowBlock::CellBlock::number_, YExcel::Worksheet::CellTable::RowBlock::DBCell::offsets_, YExcel::CODE::RK, YExcel::Worksheet::CellTable::RowBlock::CellBlock::rk_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::LabelSST::rowIndex_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::MulRK::rowIndex_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::Number::rowIndex_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::RK::rowIndex_, YExcel::Worksheet::CellTable::RowBlock::rows_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::LabelSST::SSTRecordIndex_, YExcel::BasicExcelCell::STRING, YExcel::BasicExcelCell::Type(), YExcel::Worksheet::CellTable::RowBlock::CellBlock::type_, YExcel::BasicExcelCell::UNDEFINED, YExcel::Worksheet::CellTable::RowBlock::CellBlock::Number::value_, YExcel::Worksheet::CellTable::RowBlock::CellBlock::RK::value_, YExcel::BasicExcelCell::WSTRING, and YExcel::Worksheet::CellTable::RowBlock::CellBlock::MulRK::XFRK_.

Here is the call graph for this function:

◆ UpdateYExcelWorksheet()

void YExcel::BasicExcel::UpdateYExcelWorksheet ( )
private

Update yesheets_ using information from worksheets_.

Definition at line 5083 of file BasicExcel.cpp.

◆ Write()

size_t YExcel::BasicExcel::Write ( char *  data)
private

Definition at line 4902 of file BasicExcel.cpp.

Member Data Documentation

◆ file_

CompoundFile YExcel::BasicExcel::file_

Compound file handler.

Definition at line 1166 of file BasicExcel.hpp.

◆ workbook_

◆ worksheets_

std::vector<Worksheet> YExcel::BasicExcel::worksheets_

Raw Worksheets.

Definition at line 1168 of file BasicExcel.hpp.

Referenced by YExcel::BasicExcelWorksheet::UpdateCells().

◆ yesheets_

std::vector<BasicExcelWorksheet> YExcel::BasicExcel::yesheets_

Parsed Worksheets.

Definition at line 1169 of file BasicExcel.hpp.


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