---
Product: Aspose.Cells
Platform: cpp
Page Type: index
Canonical URL: https://products.aspose.org/cells/cpp/
---

# Aspose.Cells FOSS for C++

Open-source C++ library for creating, loading, editing, and saving Excel .xlsx workbooks without Microsoft Excel.

Open-source C++ library for Excel .xlsx workbooks. Create, edit, style, and save spreadsheets with cells, formulas, and formatting. MIT licensed.

## Aspose.Cells FOSS — Open Source C++ Spreadsheet Library

Aspose.Cells FOSS for C++ is an open-source library that enables developers to programmatically
create, load, edit, and save Excel `.xlsx` workbooks without requiring Microsoft Excel or any
COM interop. The library provides a native C++ API that integrates directly into CMake-based
build systems with no external runtime dependencies.

The core API covers `Workbook` creation and persistence, `Worksheet` and cell manipulation via
`Worksheet.GetCells()`, cell value assignment using `Cell.PutValue()`, formula entry with
`Cell.SetFormula()`, and rich styling through the `Style`, `Font`, and `Color` classes. Number
format display is handled by `DisplayTextFormatter` with full locale support. Named ranges are
managed through `DefinedNameUtility` and related collection classes.

Aspose.Cells FOSS for C++ is released under the MIT license with no runtime fees or
usage restrictions. Build from source using CMake and integrate directly into your
project as a header-and-source library. For enterprise features and support, see [Aspose.Cells for C++ — Enterprise Product](https://products.aspose.com/cells/cpp/).

## Workbook and Worksheet Management

- Create new `Workbook` instances or load existing `.xlsx` files
- Access and iterate worksheets via `WorksheetCollection`
- Rename worksheets with `Worksheet.SetName()`
- Retrieve and manipulate cells through `Worksheet.GetCells()`
- Save workbooks to file path with `Workbook.Save()`

## Typical use cases

- Generate Excel reports from application data
- Transform and reformat existing spreadsheets
- Produce template-driven output files in server environments
- Build automated data export pipelines without Excel installed

## Cell Values, Formulas, and Number Formats

- Write text and numeric values with `Cell.PutValue()`
- Enter Excel formulas using `Cell.SetFormula()`
- Read formatted cell text via `DisplayTextFormatter`
- Apply number format patterns using `Style.SetNumber()`
- Parse numeric format strings with `ParsedNumericFormat`

## Typical use cases

- Build financial spreadsheets with SUM, AVERAGE, and IF formulas
- Format currency, percentage, and date columns automatically
- Extract display-ready text from cells for reporting
- Validate and normalize numeric data before export

## Cell Styling with Fonts, Colors, and Borders

- Retrieve and modify cell styles via `Cell.GetStyle()` and `Cell.SetStyle()`
- Configure fonts using `Style.SetFont()` with `Font.SetBold()` and `Font.SetColor()`
- Set background fill patterns with `Style.SetPattern()` and `Style.SetForegroundColor()`
- Construct ARGB colors with `Color.FromArgb()`
- Apply consistent styles across header rows and data ranges

## Typical use cases

- Add branded header rows with colored backgrounds and bold text
- Highlight summary rows with fill patterns and custom fonts
- Generate consistently styled output for business dashboards
- Apply table-level formatting in a single pass

## Page Setup and Print Configuration

- Configure paper size, orientation, and scaling via `PageSetup`
- Set fit-to-page and print area options with `PageSetup` methods
- Define print headers, footers, and margins
- Control row and column repeat groups for multi-page printing

## Typical use cases

- Prepare printable invoices and formatted reports
- Define consistent print margins for regulatory documents
- Configure landscape layout for wide financial tables
- Set up repeating header rows for multi-page output

## Create a Styled Workbook and Save as .xlsx

Create a workbook, populate cells with values and a formula, apply header styling, and save:

```cpp
#include "aspose/cells_foss/Workbook.h"
#include "aspose/cells_foss/Worksheet.h"
#include "aspose/cells_foss/Cell.h"
#include "aspose/cells_foss/Style.h"
#include "aspose/cells_foss/Color.h"
#include "aspose/cells_foss/Font.h"
using namespace Aspose::Cells_FOSS;
int main() {
    Workbook workbook;
    Worksheet& sheet = workbook.GetWorksheets()[0];
    sheet.SetName("Products");
    sheet.GetCells()["A1"].PutValue("Product");
    sheet.GetCells()["B1"].PutValue("Price");
    sheet.GetCells()["A2"].PutValue("Apple");
    sheet.GetCells()["B2"].PutValue(2.99);
    sheet.GetCells()["B4"].SetFormula("=SUM(B2:B3)");
    Style headerStyle = sheet.GetCells()["A1"].GetStyle();
    Font font;
    font.SetBold(true);
    font.SetColor(Color::FromArgb(255, 255, 255, 255));
    headerStyle.SetFont(font);
    headerStyle.SetForegroundColor(Color::FromArgb(255, 34, 120, 212));
    sheet.GetCells()["A1"].SetStyle(headerStyle);
    workbook.Save("products.xlsx");
    return 0;
}
```

## Frequently Asked Questions

### What license does Aspose.Cells FOSS for C++ use?

MIT License — free for commercial and open-source use. Include the `LICENSE.txt` file when distributing.

### Which file formats are supported?

`.xlsx` for both load and save. `.csv` load is supported; `.csv` save is not available in v0.1.

### How do I install the library?

Clone the repository and use CMake `add_subdirectory` or `FetchContent`. Requires a `C++17` compiler and `CMake 3.15+`. No external dependencies.

### Does the library require Microsoft Excel?

No. Aspose.Cells FOSS for C++ is fully self-contained and does not require Microsoft Excel or any COM interop.

### Are all API classes fully implemented?

Several classes in v0.1 are declared but stub-only, including `ConditionalFormattingCollection` and `AutoFilter`. Core `Workbook`, `Worksheet`, `Cell`, and `Style` operations are fully functional.

## Support and Learning Resources

- [Documentation](https://docs.aspose.org/cells/cpp/)
- [API References](https://reference.aspose.org/cells/cpp/)
- [Free Support](https://forum.aspose.org/)
- [Contribution](https://contribution.aspose.org/)
- [Blog](https://blog.aspose.org/)
- [New Releases](https://releases.aspose.org/)