Workbook

interface ClosedXML.Excel.IXLWorkbook : IXLProtectable<IXLWorkbookProtection, XLWorkbookProtectionElements>, IDisposable

Subclassed by XLWorkbook

Public Functions

XLCellValue Evaluate (String expression)

Evaluate a formula expression.

Param expression

Formula expression to evaluate.

Throws MissingContextException

If the expression contains a function that requires a context (e.g. current cell or worksheet).

void RecalculateAllFormulas ()

Force recalculation of all cell formulas.

void Save ()

Saves the current workbook.

void Save (Boolean validate, Boolean evaluateFormulae = false)

Saves the current workbook and optionally performs validation

void SaveAs (String file)

Saves the current workbook to a file.

void SaveAs (String file, Boolean validate, Boolean evaluateFormulae = false)

Saves the current workbook to a file and optionally validates it.

void SaveAs (Stream stream)

Saves the current workbook to a stream.

void SaveAs (Stream stream, Boolean validate, Boolean evaluateFormulae = false)

Saves the current workbook to a stream and optionally validates it.

IEnumerable<IXLCell> Search (String searchText, CompareOptions compareOptions = CompareOptions.Ordinal, Boolean searchFormulae = false)

Searches the cells’ contents for a given piece of text

Param searchText

The search text.

Param compareOptions

The compare options.

Param searchFormulae

if set to true search formulae instead of cell values.

IXLTable Table (String tableName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)

Gets the Excel table of the given name

Param tableName

Name of the table to return.

Param comparisonType

One of the enumeration values that specifies how the strings will be compared.

Throws ArgumentOutOfRangeException

If no tables with this name could be found in the workbook.

Return

The table with given name

Properties

XLCalculateMode CalculateMode { get; set; }

Gets or sets the workbook’s calculation mode.

Double ColumnWidth { get; set; }

Gets or sets the default column width for the workbook.

All new worksheets will use this column width.

IXLNamedRanges NamedRanges { get; set; }

Gets an object to manipulate this workbook’s named ranges.

IXLOutline Outline { get; set; }

Gets or sets the default outline options for the workbook.

All new worksheets will use these outline options.

IXLPageSetup PageOptions { get; set; }

Gets or sets the default page options for the workbook.

All new worksheets will use these page options.

XLWorkbookProperties Properties { get; set; }

Gets or sets the workbook’s properties.

XLReferenceStyle ReferenceStyle { get; set; }

Gets or sets the workbook’s reference style.

Double RowHeight { get; set; }

Gets or sets the default row height for the workbook.

All new worksheets will use this row height.

IXLStyle Style { get; set; }

Gets or sets the default style for the workbook.

All new worksheets will use this style.

IXLTheme Theme { get; set; }

Gets an object to manipulate this workbook’s theme.

IXLWorksheets Worksheets { get; set; }

Gets an object to manipulate the worksheets.