Book class reference
-
bool load(const wchar_t* filename)
Loads a xls-file into memory. Returns false if error occurs. Get error info with Book::errorMessage().
-
bool save(const wchar_t* filename)
Saves current workbook into xls-file. Returns false if error occurs. Get error info with Book::errorMessage().
-
bool loadRaw(const char* data, unsigned size)
Loads a xls-file from user's memory buffer. Parameters:
data - pointer to buffer;
size - size of data in buffer.
Returns false if error occurs. Get error info with Book::errorMessage().
-
bool saveRaw(const char** data, unsigned* size)
Saves a xls-file to internal memory buffer. Parameters:
data - pointer to buffer;
size - pointer to saved size.
Returns false if error occurs. Get error info with Book::errorMessage().
-
Sheet* addSheet(const wchar_t* name, Sheet* initSheet = 0)
Adds a new sheet to this book, returns the sheet pointer. Use initSheet parameter if you wish to copy an existing sheet. Returns NULL if error occurs. Get error info with Book::errorMessage().
-
Sheet* getSheet(unsigned short index) const
-
bool delSheet(unsigned short index)
-
unsigned short sheetCount() const
Returns a number of sheets in this book.
-
Format* addFormat(Format* initFormat = 0)
Adds a new format to the workbook, initial parameters can be copied from other format. Returns NULL if error occurs.
-
Font* addFont(Font* initFont = 0)
Adds a new font to the workbook, initial parameters can be copied from other font. Returns NULL if error occurs.
-
unsigned addCustomNumFormat(const wchar_t* customNumFormat)
-
const wchar_t* customNumFormat(unsigned fmt) const
-
Format* format(unsigned short index)
Returns a format with defined index. Index must be less than return value of formatSize() method.
-
unsigned short formatSize()
Returns a number of formats in this book.
-
Font* font(unsigned short index)
Returns a font with defined index. Index must be less than return value of fontSize() method.
-
unsigned short fontSize()
Returns a number of fonts in this book.
-
double datePack(unsigned short year, unsigned short month, unsigned short day,
unsigned short hour = 0, unsigned short min = 0, unsigned short sec = 0, unsigned short msec = 0)
Packs date and time information into double type.
-
bool dateUnpack(double value,
unsigned short* year, unsigned short* month, unsigned short* day,
unsigned short* hour = 0, unsigned short* min = 0, unsigned short* sec = 0, unsigned short* msec = 0)
Unpacks date and time information from double type. Returns false if error occurs.
-
Color colorPack(unsigned short red, unsigned short green, unsigned short blue)
Packs red, green and blue components in color type. Used for xlsx format only.
-
void colorUnpack(Color color, unsigned short* red, unsigned short* green, unsigned short* blue)
Unpacks color type to red, green and blue components. Used for xlsx format only.
-
unsigned short activeSheet() const
Returns an active sheet index in this workbook.
-
void setActiveSheet(unsigned short index)
Sets an active sheet index in this workbook.
-
int addPicture(const wchar_t* filename)
Adds a picture to the workbook. Returns a picture identifier. Supports BMP, DIB, PNG, JPG and WMF picture formats. Use picture identifier with Sheet::setPicture(). Returns -1 if error occurs. Get error info with Book::errorMessage().
-
int addPicture2(const char* data, unsigned size)
Adds a picture to the workbook from memory buffer:
data - pointer to buffer with picture data (BMP, DIB, PNG, JPG or WMF formats);
size - size of data in buffer.
Returns a picture identifier. Use picture identifier with Sheet::setPicture(). Returns -1 if error occurs. Get error info with Book::errorMessage().
-
const wchar_t* defaultFont(unsigned short* fontSize)
Returns a default font name and size for this workbook. Returns 0 if error occurs. Get error info with Book::errorMessage().
-
void setDefaultFont(const wchar_t* fontName, unsigned short fontSize)
Sets a default font name and size for this workbook.
-
bool rgbMode()
Returns whether the RGB mode is active. Used for xlsx format only.
-
void setRgbMode(bool rgbMode = true)
Sets a RGB mode: true - RGB mode, false - Index mode (default). In RGB mode use colorPack() and colorUnpack() methods for getting/setting colors. Used for xlsx format only.
-
void setKey(const wchar_t* name, const wchar_t* key)
Sets customer's key.
-
void setLocale(const char* locale)
Sets the locale for this library. It has no effect for unicode projects.
-
const char* errorMessage() const
Returns the last error message.
-
void release()
Deletes this object and free resources.
|