LibXL: Book class reference

LibXL excel library for developers
Index Book Sheet Format Font ### 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(int index) const Gets pointer to a sheet with specified index. Returns NULL if error occurs. Get error info with Book::errorMessage(). bool delSheet(int index) Deletes a sheet with specified index. Returns false if error occurs. Get error info with Book::errorMessage(). int 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. int addCustomNumFormat(const wchar_t* customNumFormat) Adds a new custom number format to the workbook. The format string customNumFormat indicates how to format and render the numeric value of a cell. See custom format strings guidelines. Returns the custom format identifier. It's used in Format::setNumFormat(). Returns 0 if error occurs. Get error info with Book::errorMessage(). const wchar_t* customNumFormat(int fmt) const Returns a custom format string for specified custom format identifier fmt. See custom format string guidelines. Returns NULL if error occurs. Get error info with Book::errorMessage(). Format* format(int index) Returns a format with defined index. Index must be less than return value of formatSize() method. int formatSize() Returns a number of formats in this book. Font* font(int index) Returns a font with defined index. Index must be less than return value of fontSize() method. int fontSize() Returns a number of fonts in this book. double datePack(int year, int month, int day, int hour = 0, int min = 0, int sec = 0, int msec = 0) Packs date and time information into double type. bool dateUnpack(double value, int* year, int* month, int* day, int* hour = 0, int* min = 0, int* sec = 0, int* msec = 0) Unpacks date and time information from double type. Returns false if error occurs. Color colorPack(int red, int green, int blue) Packs red, green and blue components in color type. void colorUnpack(Color color, int* red, int* green, int* blue) Unpacks color type to red, green and blue components. int activeSheet() const Returns an active sheet index in this workbook. void setActiveSheet(int 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(int* 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, int 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. Index Book Sheet Format Font