Home Index Book Sheet Format Font AutoFilter FilterColumn RichString FormControl
ConditionalFormatting ConditionalFormat Examples
ConditionalFormatting ConditionalFormat Examples
Factory functions
-
Book* book = xlCreateBook();
Creates a book instance for working with XLS files. This function should be called first for receiving a book pointer. This function and other classes are in the libxl namespace.
-
Book* book = xlCreateXMLBook();
Creates a book instance for working with XLSX files. This function should be called first for receiving a book pointer. This function and other classes are in the libxl namespace.
Book class
- bool load(const wchar_t* filename, const wchar_t* tempFile = 0)
- bool loadSheet(const wchar_t* filename, int sheetIndex, const wchar_t* tempFile = 0, bool keepAllSheets = false)
- bool loadPartially(const wchar_t* filename, int sheetIndex, int firstRow, int lastRow, const wchar_t* tempFile = 0, bool keepAllSheets = false)
- bool loadWithoutEmptyCells(const wchar_t* filename)
- bool loadInfo(const wchar_t* filename)
- bool save(const wchar_t* filename, bool useTempFile = false)
- bool loadRaw(const char* data, unsigned size, int sheetIndex = -1, int firstRow = -1, int lastRow = -1, bool keepAllSheets = false)
- bool saveRaw(const char** data, unsigned* size)
- Sheet* addSheet(const wchar_t* name, Sheet* initSheet = 0)
- Sheet* insertSheet(int index, const wchar_t* name, Sheet* initSheet = 0)
- Sheet* getSheet(int index) const
- const wchar_t* getSheetName(int index) const
- SheetType sheetType(int index) const
- bool moveSheet(int srcIndex, int dstIndex)
- bool delSheet(int index)
- int sheetCount() const
- Format* addFormat(Format* initFormat = 0)
- Format* addFormatFromStyle(CellStyle style)
- Font* addFont(Font* initFont = 0)
- RichString* addRichString()
- int addCustomNumFormat(const wchar_t* customNumFormat)
- const wchar_t* customNumFormat(int fmt) const
- Format* format(int index)
- int formatSize()
- Font* font(int index)
- int fontSize()
- ConditionalFormat* addConditionalFormat()
- double datePack(int year, int month, int day, int hour = 0, int min = 0, int sec = 0, int msec = 0)
- bool dateUnpack(double value,
int* year, int* month, int* day,
int* hour = 0, int* min = 0, int* sec = 0, int* msec = 0) - Color colorPack(int red, int green, int blue)
- void colorUnpack(Color color, int* red, int* green, int* blue)
- int activeSheet() const
- void setActiveSheet(int index)
- int pictureSize() const
- PictureType getPicture(int index, const char** data, unsigned* size) const
- int addPicture(const wchar_t* filename)
- int addPicture2(const char* data, unsigned size)
- int addPictureAsLink(const wchar_t* filename, bool insert = false)
- const wchar_t* defaultFont(int* fontSize)
- void setDefaultFont(const wchar_t* fontName, int fontSize)
- bool rgbMode()
- void setRgbMode(bool rgbMode = true)
- CalcModeType calcMode() const
- void setCalcMode(CalcModeType calcMode)
- bool refR1C1() const
- void setRefR1C1(bool refR1C1 = true)
- int version() const
- int biffVersion() const
- bool isDate1904() const
- void setDate1904(bool date1904 = true)
- bool isTemplate() const
- void setTemplate(bool tmpl = true)
- bool isWriteProtected() const
- bool removeVBA()
- bool removePrinterSettings()
- void setKey(const wchar_t* name, const wchar_t* key)
- bool setLocale(const char* locale)
- const char* errorMessage() const
- void release()
Sheet class
- CellType cellType(int row, int col) const
- bool isFormula(int row, int col) const
- Format* cellFormat(int row, int col) const
- void setCellFormat(int row, int col, Format* format)
- const wchar_t* readStr(int row, int col, Format** format = 0)
- bool writeStr(int row, int col, const wchar_t* value, Format* format = 0, CellType type = CELLTYPE_STRING)
- RichString* readRichStr(int row, int col, Format** format = 0)
- bool writeRichStr(int row, int col, RichString* richString, Format* format = 0)
- double readNum(int row, int col, Format** format = 0) const
- bool writeNum(int row, int col, double value, Format* format = 0)
- bool readBool(int row, int col, Format** format = 0) const
- bool writeBool(int row, int col, bool value, Format* format = 0) const
- bool readBlank(int row, int col, Format** format = 0) const
- bool writeBlank(int row, int col, Format* format)
- const wchar_t* readFormula(int row, int col, Format** format = 0)
- bool writeFormula(int row, int col, const wchar_t* value, Format* format = 0)
- bool writeFormulaNum(int row, int col, const wchar_t* expr, double value, Format* format = 0)
- bool writeFormulaStr(int row, int col, const wchar_t* expr, const wchar_t* value, Format* format = 0)
- bool writeFormulaBool(int row, int col, const wchar_t* expr, bool value, Format* format = 0)
- const wchar_t* readComment(int row, int col) const
- void writeComment(int row, int col, const wchar_t* value, const wchar_t* author = 0, int width = 129, int height = 75)
- void removeComment(int row, int col)
- bool isDate(int row, int col) const
- bool isRichStr(int row, int col) const
- ErrorType readError(int row, int col) const
- void writeError(int row, int col, ErrorType error, Format* format = 0)
- double colWidth(int col) const
- double rowHeight(int row) const
- int colWidthPx(int col) const
- int rowHeightPx(int row) const
- bool setCol(int colFirst, int colLast, double width, Format* format = 0, bool hidden = false)
- bool setRow(int row, double height, Format* format = 0, bool hidden = false)
- bool setColPx(int colFirst, int colLast, int widthPx, Format* format = 0, bool hidden = false)
- bool setRowPx(int row, int heightPx, Format* format = 0, bool hidden = false)
- bool rowHidden(int row) const
- bool setRowHidden(int row, bool hidden)
- bool colHidden(int col) const
- bool setColHidden(int col, bool hidden)
- double defaultRowHeight() const
- void setDefaultRowHeight(double height)
- bool getMerge(int row, int col, int* rowFirst, int* rowLast, int* colFirst, int* colLast)
- bool setMerge(int rowFirst, int rowLast, int colFirst, int colLast)
- bool delMerge(int row, int col)
- int mergeSize() const
- bool merge(int index, int* rowFirst, int* rowLast, int* colFirst, int* colLast)
- bool delMergeByIndex(int index)
- int pictureSize() const
- int getPicture(int index, int* rowTop, int* colLeft, int* rowBottom, int* colRight, int* width, int* height, int* offset_x, int* offset_y)
- bool removePictureByIndex(int index)
- void setPicture(int row, int col, int pictureId, double scale = 1.0, int offset_x = 0, int offset_y = 0, Position pos = POSITION_MOVE_AND_SIZE)
- void setPicture2(int row, int col, int pictureId, int width = -1, int height = -1, int offset_x = 0, int offset_y = 0, Position pos = POSITION_MOVE_AND_SIZE)
- bool removePicture(int row, int col)
- int getHorPageBreak(int index) const
- int getHorPageBreakSize() const
- int getVerPageBreak(int index) const
- int getVerPageBreakSize() const
- bool setHorPageBreak(int row, bool pageBreak = true)
- bool setVerPageBreak(int col, bool pageBreak = true)
- void split(int row, int col)
- bool splitInfo(int* row, int* col) const
- bool groupRows(int rowFirst, int rowLast, bool collapsed = true)
- bool groupCols(int colFirst, int colLast, bool collapsed = true)
- bool groupSummaryBelow() const
- void setGroupSummaryBelow(bool below)
- bool groupSummaryRight() const
- void setGroupSummaryRight(bool right)
- bool clear(int rowFirst = 0, int rowLast = 1048575, int colFirst = 0, int colLast = 16383)
- bool insertRow(int rowFirst, int rowLast, bool updateNamedRanges = true)
- bool insertCol(int colFirst, int colLast, bool updateNamedRanges = true)
- bool removeRow(int rowFirst, int rowLast, bool updateNamedRanges = true)
- bool removeCol(int colFirst, int colLast, bool updateNamedRanges = true)
- bool copyCell(int rowSrc, int colSrc, int rowDst, int colDst)
- int firstRow() const
- int lastRow() const
- int firstCol() const
- int lastCol() const
- int firstFilledRow() const
- int lastFilledRow() const
- int firstFilledCol() const
- int lastFilledCol() const
- bool displayGridlines() const
- void setDisplayGridlines(bool show = true)
- bool printGridlines() const
- void setPrintGridlines(bool print = true)
- int zoom() const
- void setZoom(int zoom)
- int printZoom() const
- void setPrintZoom(int zoom)
- bool landscape() const
- void setLandscape(bool landscape = true)
- bool getPrintFit(int* wPages, int* hPages) const
- void setPrintFit(int wPages = 1, int hPages = 1)
- Paper paper() const
- void setPaper(Paper paper = PAPER_DEFAULT)
- const wchar_t* header() const
- bool setHeader(const wchar_t* header, double margin = 0.5)
- double headerMargin() const
- const wchar_t* footer() const
- bool setFooter(const wchar_t* footer, double margin = 0.5)
- double footerMargin() const
- bool hCenter() const
- void setHCenter(bool hCenter = true)
- bool vCenter() const
- void setVCenter(bool vCenter = true)
- double marginLeft() const
- void setMarginLeft(double margin)
- double marginRight() const
- void setMarginRight(double margin)
- double marginTop() const
- void setMarginTop(double margin)
- double marginBottom() const
- void setMarginBottom(double margin)
- bool printRowCol() const
- void setPrintRowCol(bool print = true)
- bool printRepeatRows(int* rowFirst, int* rowLast)
- void setPrintRepeatRows(int rowFirst, int rowLast)
- bool printRepeatCols(int* colFirst, int* colLast)
- void setPrintRepeatCols(int colFirst, int colLast)
- bool printArea(int* rowFirst, int* rowLast, int* colFirst, int* colLast)
- void setPrintArea(int rowFirst, int rowLast, int colFirst, int colLast)
- void clearPrintRepeats()
- void clearPrintArea()
- bool getNamedRange(const wchar_t* name, int* rowFirst, int* rowLast, int* colFirst, int* colLast, int scopeId = SCOPE_UNDEFINED, bool* hidden = 0)
- bool setNamedRange(const wchar_t* name, int rowFirst, int rowLast, int colFirst, int colLast, int scopeId = SCOPE_UNDEFINED)
- bool delNamedRange(const wchar_t* name, int scopeId = SCOPE_UNDEFINED)
- int namedRangeSize() const
- const wchar_t* namedRange(int index, int* rowFirst, int* rowLast, int* colFirst, int* colLast, int* scopeId = 0, bool* hidden = 0)
- bool getTable(const wchar_t* name, int* rowFirst, int* rowLast, int* colFirst, int* colLast, int* headerRowCount, int* totalsRowCount)
- int tableSize() const
- const wchar_t* table(int index, int* rowFirst, int* rowLast, int* colFirst, int* colLast, int* headerRowCount, int* totalsRowCount)
- int hyperlinkSize() const
- const wchar_t* hyperlink(int index, int* rowFirst, int* rowLast, int* colFirst, int* colLast)
- bool delHyperlink(int index)
- void addHyperlink(const wchar_t* hyperlink, int rowFirst, int rowLast, int colFirst, int colLast)
- int hyperlinkIndex(int row, int col) const
- bool isAutoFilter() const
- AutoFilter autoFilter()
- void applyFilter()
- void removeFilter()
- const wchar_t* name() const
- void setName(const wchar_t* name)
- bool protect() const
- void setProtect(bool protect = true, const wchar_t* password = 0, EnhancedProtection prot = PROT_DEFAULT)
- bool rightToLeft() const
- void setRightToLeft(bool rightToLeft = true)
- SheetState hidden() const
- bool setHidden(SheetState state = SHEETSTATE_HIDDEN)
- void getTopLeftView(int* row, int* col) const
- void setTopLeftView(int row, int col)
- void setAutoFitArea(int rowFirst = 0, int colFirst = 0, int rowLast = -1, int colLast = -1)
- void addrToRowCol(const wchar_t* addr, int* row, int* col, bool* rowRelative = 0, bool* colRelative = 0)
- const wchar_t* rowColToAddr(int row, int col, bool rowRelative = true, bool colRelative = true)
- Color tabColor() const
- void setTabColor(Color color)
- bool getTabColor(int* red, int* green, int* blue) const
- void setTabColor(int red, int green, int blue)
- bool addIgnoredError(int rowFirst, int colFirst, int rowLast, int colLast, IgnoredError iError)
- void addDataValidation(DataValidationType type, DataValidationOperator op, int rowFirst, int rowLast, int colFirst, int colLast, const wchar_t* value1, const wchar_t* value2, bool allowBlank = true, bool hideDropDown = false, bool showInputMessage = true, bool showErrorMessage = true, const wchar_t* promptTitle, const wchar_t* prompt = 0, const wchar_t* errorTitle = 0, const wchar_t* error = 0, DataValidationErrorStyle errorStyle = VALIDATION_ERRSTYLE_STOP)
- void addDataValidationDouble(DataValidationType type, DataValidationOperator op, int rowFirst, int rowLast, int colFirst, int colLast, double value1, double value2, bool allowBlank = true, bool hideDropDown = false, bool showInputMessage = true, bool showErrorMessage = true, const wchar_t* promptTitle, const wchar_t* prompt = 0, const wchar_t* errorTitle = 0, const wchar_t* error = 0, DataValidationErrorStyle errorStyle = VALIDATION_ERRSTYLE_STOP)
- void removeDataValidations()
- int formControlSize() const
- FormControl* formControl(int index)
- ConditionalFormatting* addConditionalFormatting()
- bool getActiveCell(int* row, int* col) const
- void setActiveCell(int row, int col)
- const wchar_t* selectionRange() const
- void addSelectionRange(const wchar_t* sqref)
- void removeSelection()
Format class
- Font* font() const
- bool setFont(Font* font)
- int numFormat() const
- void setNumFormat(int numFormat)
- AlignH alignH() const
- void setAlignH(AlignH align)
- AlignV alignV() const
- void setAlignV(AlignV align)
- bool wrap() const
- void setWrap(bool wrap = true)
- int rotation() const
- bool setRotation(int rotation)
- int indent() const
- void setIndent(int indent)
- bool shrinkToFit() const
- void setShrinkToFit(bool shrinkToFit = true)
- void setBorder(BorderStyle style = BORDERSTYLE_THIN)
- void setBorderColor(Color color)
- BorderStyle borderLeft() const
- void setBorderLeft(BorderStyle style = BORDERSTYLE_THIN)
- BorderStyle borderRight() const
- void setBorderRight(BorderStyle style = BORDERSTYLE_THIN)
- BorderStyle borderTop() const
- void setBorderTop(BorderStyle style = BORDERSTYLE_THIN)
- BorderStyle borderBottom() const
- void setBorderBottom(BorderStyle style = BORDERSTYLE_THIN)
- Color borderLeftColor() const
- void setBorderLeftColor(Color color)
- Color borderRightColor() const
- void setBorderRightColor(Color color)
- Color borderTopColor() const
- void setBorderTopColor(Color color)
- Color borderBottomColor() const
- void setBorderBottomColor(Color color)
- BorderDiagonal borderDiagonal() const
- void setBorderDiagonal(BorderDiagonal border)
- BorderStyle borderDiagonalStyle() const
- void setBorderDiagonalStyle(BorderStyle style)
- Color borderDiagonalColor() const
- void setBorderDiagonalColor(Color color)
- FillPattern fillPattern() const
- void setFillPattern(FillPattern pattern)
- Color patternForegroundColor() const
- void setPatternForegroundColor(Color color)
- Color patternBackgroundColor() const
- void setPatternBackgroundColor(Color color)
- bool locked() const
- void setLocked(bool locked = true)
- bool hidden() const
- void setHidden(bool hidden = true)
Font class
- int size() const
- void setSize(int size)
- bool italic() const
- void setItalic(bool italic = true)
- bool strikeOut() const
- void setStrikeOut(bool strikeOut = true)
- Color color() const
- void setColor(Color color)
- bool bold() const
- void setBold(bool bold = true)
- Script script() const
- void setScript(Script script)
- Underline underline() const
- void setUnderline(Underline underline)
- const wchar_t* name() const
- bool setName(const wchar_t* name)
AutoFilter class
- bool getRef(int* rowFirst, int* rowLast, int* colFirst, int* colLast)
- void setRef(int rowFirst, int rowLast, int colFirst, int colLast)
- FilterColumn column(int colId)
- int columnSize() const
- FilterColumn columnByIndex(int index)
- bool getSortRange(int* rowFirst, int* rowLast, int* colFirst, int* colLast)
- bool getSort(int* columnIndex, bool* descending)
- bool setSort(int columnIndex, bool descending = false)
- bool addSort(int columnIndex, bool descending = false)
FilterColumn class
- int index() const
- Filter filterType() const
- int filterSize() const
- const wchar_t* filter(int index) const
- void addFilter(const wchar_t* value)
- bool getTop10(double* value, bool* top, bool* percent)
- void setTop10(double value, bool top = true, bool percent = false)
- bool getCustomFilter(Operator* op1, const wchar_t** v1, Operator* op2, const wchar_t** v2, bool* andOp)
- void setCustomFilter(Operator op1, const wchar_t* v1, Operator op2 = OPERATOR_EQUAL, const wchar_t* v2 = 0, bool andOp = false)
- void clear()
RichString class
- Font* addFont(Font* initFont = 0)
- void addText(const wchar_t* text, Font* font = 0)
- const wchar_t* getText(int index, Font** font = 0)
- int textSize() const
FormControl class
- ObjectType objectType() const
- CheckedType checked() const
- void setChecked(CheckedType checked)
- const wchar_t* fmlaGroup()
- void setFmlaGroup(const wchar_t* group)
- const wchar_t* fmlaLink()
- void setFmlaLink(const wchar_t* link)
- const wchar_t* fmlaRange()
- void setFmlaRange(const wchar_t* range)
- const wchar_t* fmlaTxbx()
- void setFmlaTxbx(const wchar_t* txbx)
- const wchar_t* name()
- const wchar_t* linkedCell()
- const wchar_t* listFillRange()
- const wchar_t* macro()
- const wchar_t* altText()
- bool locked() const
- bool defaultSize() const
- bool print() const
- bool disabled() const
- const wchar_t* item(int index)
- int itemSize() const
- void addItem(const wchar_t* value)
- void insertItem(int index, const wchar_t* value)
- void clearItems()
- int dropLines() const
- void setDropLines(int lines)
- int dx() const
- void setDx(int dx)
- bool firstButton() const
- void setFirstButton(bool firstButton)
- bool horiz() const
- void setHoriz(bool horiz)
- int inc() const
- void setInc(int inc)
- int getMax() const
- void setMax(int max)
- int getMin() const
- void setMin(int min)
- const wchar_t* multiSel() const
- void setMultiSel(const wchar_t* value)
- int sel() const
- void setSel(int sel)
- bool fromAnchor(int* col, int* colOff, int* row, int* rowOff)
- bool toAnchor(int* col, int* colOff, int* row, int* rowOff)
ConditionalFormatting class
- void addRange(int rowFirst, int rowLast, int colFirst, int colLast)
- void addRule(CFormatType type, ConditionalFormat* cFormat, const wchar_t* value = 0, bool stopIfTrue = 0)
- void addTopRule(ConditionalFormat* cFormat, int value, bool bottom = false, bool percent = false, bool stopIfTrue = 0)
- void addOpNumRule(CFormatOperator op, ConditionalFormat* cFormat, double value1, double value2 = 0, bool stopIfTrue = 0)
- void addOpStrRule(CFormatOperator op, ConditionalFormat* cFormat, const wchar_t* value1, const wchar_t* value2 = 0, bool stopIfTrue = 0)
- void addAboveAverageRule(ConditionalFormat* cFormat, bool aboveAverage = true, bool equalAverage = false, int stdDev = 0, bool stopIfTrue = 0)
- void addTimePeriodRule(ConditionalFormat* cFormat, CFormatTimePeriod timePeriod, bool stopIfTrue = 0)
- void add2ColorScaleRule(Color minColor, Color maxColor, CFVOType minType = CFVO_MIN, double minValue = 0, CFVOType maxType = CFVO_MAX, double maxValue = 0, bool stopIfTrue = 0)
- void add2ColorScaleFormulaRule(Color minColor, Color maxColor, CFVOType minType = CFVO_FORMULA, const char* minValue = 0, CFVOType maxType = CFVO_FORMULA, const wchar_t* maxValue = 0, bool stopIfTrue = 0)
- void add3ColorScaleRule(Color minColor, Color midColor, Color maxColor, CFVOType minType = CFVO_MIN, double minValue = 0, CFVOType midType = CFVO_PERCENTILE, double midValue = 50, CFVOType maxType = CFVO_MAX, double maxValue = 0, bool stopIfTrue = 0)
- void add3ColorScaleFormulaRule(Color minColor, Color midColor, Color maxColor, CFVOType minType = CFVO_FORMULA, const wchar_t* minValue = 0, CFVOType midType = CFVO_FORMULA, const wchar_t* midValue = 50, CFVOType maxType = CFVO_FORMULA, const wchar_t* maxValue = 0, bool stopIfTrue = 0)
ConditionalFormat class
- Font* font()
- NumFormat numFormat() const
- void setNumFormat(NumFormat numFormat)
- const wchar_t* customNumFormat() const
- void setCustomNumFormat(const wchar_t* customNumFormat)
- void setBorder(BorderStyle style = BORDERSTYLE_THIN)
- void setBorderColor(Color color)
- BorderStyle borderLeft() const
- void setBorderLeft(BorderStyle style = BORDERSTYLE_THIN)
- BorderStyle borderRight() const
- void setBorderRight(BorderStyle style = BORDERSTYLE_THIN)
- BorderStyle borderTop() const
- void setBorderTop(BorderStyle style = BORDERSTYLE_THIN)
- BorderStyle borderBottom() const
- void setBorderBottom(BorderStyle style = BORDERSTYLE_THIN)
- Color borderLeftColor() const
- void setBorderLeftColor(Color color)
- Color borderRightColor() const
- void setBorderRightColor(Color color)
- Color borderTopColor() const
- void setBorderTopColor(Color color)
- Color borderBottomColor() const
- void setBorderBottomColor(Color color)
- FillPattern fillPattern() const
- void setFillPattern(FillPattern pattern)
- Color patternForegroundColor() const
- void setPatternForegroundColor(Color color)
- Color patternBackgroundColor() const
- void setPatternBackgroundColor(Color color)