Features

Features

Aspose.Cells FOSS for C++ is an open-source C++ library for creating, loading, editing, and saving Excel .xlsx workbooks without requiring Microsoft Excel. The library exposes a header-only C++ API organized around a small set of core classes.


Workbook and Worksheet Management

The Workbook class is the root object for all spreadsheet operations. Use it to create a new workbook, load an existing XLSX file, or save changes to disk.

  • Create a new workbook with Workbook()
  • Load an XLSX file with Workbook(filePath)
  • Save to file with Workbook::Save(fileName)
  • Access all sheets via Workbook::GetWorksheets()
  • Add, rename, and configure sheets through the Worksheet class

Cell Values and Formulas

The Cell class represents a single spreadsheet cell. It supports reading and writing text, numeric, boolean, and formula values.

  • Write values with Cell::PutValue(value) and Cell::SetValue(value)
  • Read values with Cell::GetValue() returning a CellValue
  • Set formulas with Cell::SetFormula(formula) — standard Excel formula syntax
  • Address cells by name ("A1") or row/column index via Cells::operator[](cellName)

Cell Styling

Apply rich formatting to cells using the Style class. Obtain the current style from Cell::GetStyle(), modify it, and apply it back with Cell::SetStyle(style).

  • Font configuration via Style::Font() returning a Font object — bold, color, size
  • Background fill patterns via Style::SetPattern(FillPattern) and Style::SetForegroundColor(Color)
  • Border configuration via Style::Borders()
  • Number format strings via Style::SetNumberFormat(format)

Page Setup and Print Layout

The PageSetup class enables configuring worksheet print settings such as paper size, orientation, margins, scaling, and header/footer text.

  • Set paper size with PageSetup::SetPaperSize(PaperSizeType)
  • Set print orientation with PageSetup::SetOrientation(PageOrientationType)
  • Configure margins: PageSetup::SetTopMargin, SetBottomMargin, SetLeftMargin, SetRightMargin
  • Fit-to-page scaling with PageSetup::SetFitToPagesTall and SetFitToPagesWide

Conditional Formatting

The ConditionalFormattingCollection class manages rule-based cell formatting. Rules can be added to worksheet ranges and priority can be managed automatically.

  • Add rules with ConditionalFormattingCollection::Add()
  • Remove rules by index or area
  • Retrieve next available priority with ConditionalFormattingCollection::GetNextPriority()

Auto-Filter

The AutoFilter class supports applying column-level data filters to worksheet ranges.

  • Set the filter range with AutoFilter::SetRange(rangeAddress)
  • Clear all active filters with AutoFilter::Clear()
  • Manage custom filters via AutoFilterCustomFilter and AutoFilterCustomFilterCollection

Named Ranges and Defined Names

The DefinedName class stores workbook-level or sheet-level named formulas and ranges for reuse in formulas and code.

  • Get the defined name with DefinedName::GetName()
  • Get or set the formula (range address) with DefinedName::GetFormula() / SetFormula(formula)
  • Scope to a specific sheet using DefinedName::GetLocalSheetIndex()

XLSX Format Support

FormatLoadSave
XLSX
CSV

All load and save operations use the Workbook::Save(fileName) overloads. The format is inferred from the file extension by default.


API Reference Summary

ClassDescription
WorkbookRoot spreadsheet object — create, load, and save XLSX files
WorksheetSingle worksheet — name, cells, page setup, and auto-filter
CellSingle cell — value, formula, and style operations
StyleCell style facade — font, fill, borders, and number format
FontFont settings — bold, color, size
PageSetupPrint layout — paper size, orientation, margins, scaling
ConditionalFormattingCollectionCollection of conditional formatting rules
AutoFilterColumn-level auto-filter for a worksheet range
DefinedNameNamed range or formula definition

See Also