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

# Workbook

## Overview

`Workbook` is a class in Aspose.Cells FOSS for C++.

Represents the root spreadsheet object used to create, load, modify, and save an XLSX workbook.

This class declares 26 methods for Workbook objects in C++ programs.
Available methods include: `Dispose`, `EnsureUniqueDefinedName`, `EnsureUniqueSheetName`, `EnsureValidDefinedNameScope`, `GetDefinedNames`, `GetDefinedNamesModel`, `GetDocumentProperties`, `GetLoadDiagnostics`, `GetModel`, `GetProperties`, `GetSettings`, `GetWorksheets`, and 2 additional methods.
Public members are accessible to any C++ application after installing the Aspose.Cells FOSS for C++ package.
Accessor methods: `Workbook`.

## Accessor Methods

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Workbook` | `Workbook` | Read | Gets the workbook. |

## Methods

| Signature | Description |
|-----------|-------------|
| `Workbook()` → `Workbook` | Calls Workbook on this Workbook instance. |
| `Workbook()` |  |
| `GetWorksheets()` → `WorksheetCollection` | Gets the worksheets in workbook order. |
| `GetWorksheets()` → `WorksheetCollection` | Returns the worksheets. |
| `GetSettings()` → `WorkbookSettings` | Gets workbook-level settings such as the date system and display culture. |
| `GetSettings()` → `WorkbookSettings` | Returns the settings. |
| `GetProperties()` → `WorkbookProperties` | Gets workbook metadata and view settings exposed by the supported public API. |
| `GetProperties()` → `WorkbookProperties` | Returns the properties. |
| `GetDocumentProperties()` → `DocumentProperties` | Gets the document properties facade for core and extended metadata. |
| `GetDocumentProperties()` → `DocumentProperties` | Returns the document properties. |
| `GetDefinedNames()` → `DefinedNameCollection` | Gets the workbook-defined names collection. |
| `GetDefinedNames()` → `DefinedNameCollection` | Returns the defined names. |
| `GetLoadDiagnostics()` → `LoadDiagnostics` | Gets diagnostics collected while loading the current workbook. |
| `GetLoadDiagnostics()` → `LoadDiagnostics` | Returns the load diagnostics. |
| `Save(fileName: std::string_view)` | Saves the workbook to an XLSX file using default save options. |
| `Save(fileName: std::string_view, format: SaveFormat)` | Saves the workbook to a file using the specified save format. |
| `Save(fileName: std::string_view, options: SaveOptions)` | Saves the workbook to a file using explicit save options. |
| `Save(stream: std::vector<std::uint8_t>, format: SaveFormat)` | Saves the workbook to a stream using the specified save format. |
| `Save(stream: std::vector<std::uint8_t>, options: SaveOptions)` | Saves the workbook to a stream using explicit save options. |
| `GetModel()` → `Core::WorkbookModel` | Gets the underlying workbook model. |
| `GetModel()` → `Core::WorkbookModel` | Returns the model. |
| `GetDefinedNamesModel()` → `std::vector<Core::DefinedNameModel>` | Gets the underlying defined names model vector. |
| `EnsureUniqueSheetName(sheetName: std::string_view, currentSheet: std::optional<std::reference_wrapper<const Core::WorksheetModel>>)` | Ensures no other worksheet in the workbook shares the given name. Throws CellsException when a duplicate is found. |
| `EnsureValidDefinedNameScope(localSheetIndex: std::optional<int>)` | Validates that the local sheet index is absent (global scope) or within the valid worksheet range. Throws CellsException otherwise. |
| `EnsureUniqueDefinedName(currentDefinedName: Core::DefinedNameModel, name: std::string_view, localSheetIndex: std::optional<int>)` | Ensures no other defined name in the workbook shares the given name and scope. Throws CellsException when a duplicate is found. |
| `Dispose()` | Releases resources associated with the workbook instance. |

## See Also

- [Aspose.Cells — Enterprise API Reference](https://reference.aspose.com/cells/)