Table of Contents

Interface IXLWorkbook

Namespace
SlapKit.Excel.Excel
Assembly
SlapKit.Excel.dll
public interface IXLWorkbook : IXLProtectable<IXLWorkbookProtection, XLWorkbookProtectionElements>, IXLProtectable, IDisposable
Inherited Members
Extension Methods

Properties

Author

string Author { get; set; }

Property Value

string

CalculateMode

Gets or sets the workbook's calculation mode.

XLCalculateMode CalculateMode { get; set; }

Property Value

XLCalculateMode

CalculationOnSave

bool CalculationOnSave { get; set; }

Property Value

bool

Chartsheets

Gets an object to manipulate the chartsheets.

IXLChartsheets Chartsheets { get; }

Property Value

IXLChartsheets

ColumnWidth

Gets or sets the default column width for the workbook.

All new worksheets will use this column width.

double ColumnWidth { get; set; }

Property Value

double

CustomProperties

IXLCustomProperties CustomProperties { get; }

Property Value

IXLCustomProperties

DefaultRightToLeft

bool DefaultRightToLeft { get; }

Property Value

bool

DefaultShowFormulas

bool DefaultShowFormulas { get; }

Property Value

bool

DefaultShowGridLines

bool DefaultShowGridLines { get; }

Property Value

bool

DefaultShowOutlineSymbols

bool DefaultShowOutlineSymbols { get; }

Property Value

bool

DefaultShowRowColHeaders

bool DefaultShowRowColHeaders { get; }

Property Value

bool

DefaultShowRuler

bool DefaultShowRuler { get; }

Property Value

bool

DefaultShowWhiteSpace

bool DefaultShowWhiteSpace { get; }

Property Value

bool

DefaultShowZeros

bool DefaultShowZeros { get; }

Property Value

bool

FileSharing

IXLFileSharing FileSharing { get; }

Property Value

IXLFileSharing

ForceFullCalculation

bool ForceFullCalculation { get; set; }

Property Value

bool

FullCalculationOnLoad

bool FullCalculationOnLoad { get; set; }

Property Value

bool

FullPrecision

bool FullPrecision { get; set; }

Property Value

bool

LockStructure

bool LockStructure { get; set; }

Property Value

bool

LockWindows

bool LockWindows { get; set; }

Property Value

bool

NamedRanges

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

IXLNamedRanges NamedRanges { get; }

Property Value

IXLNamedRanges

Outline

Gets or sets the default outline options for the workbook.

All new worksheets will use these outline options.

IXLOutline Outline { get; set; }

Property Value

IXLOutline

PageOptions

Gets or sets the default page options for the workbook.

All new worksheets will use these page options.

IXLPageSetup PageOptions { get; set; }

Property Value

IXLPageSetup

PivotCaches

Gets all pivot caches in a workbook. A one cache can be used by multiple tables. Unused caches are not saved.

IXLPivotCaches PivotCaches { get; }

Property Value

IXLPivotCaches

PredefinedStyles

IXLPredefinedStyles PredefinedStyles { get; }

Property Value

IXLPredefinedStyles

Properties

Gets or sets the workbook's properties.

XLWorkbookProperties Properties { get; set; }

Property Value

XLWorkbookProperties

ReferenceStyle

Gets or sets the workbook's reference style.

XLReferenceStyle ReferenceStyle { get; set; }

Property Value

XLReferenceStyle

RightToLeft

bool RightToLeft { get; set; }

Property Value

bool

RowHeight

Gets or sets the default row height for the workbook.

All new worksheets will use this row height.

double RowHeight { get; set; }

Property Value

double

Sheets

Gets an object to manipulate the sheets.

IXLSheets Sheets { get; }

Property Value

IXLSheets

ShowFormulas

bool ShowFormulas { get; set; }

Property Value

bool

ShowGridLines

bool ShowGridLines { get; set; }

Property Value

bool

ShowOutlineSymbols

bool ShowOutlineSymbols { get; set; }

Property Value

bool

ShowRowColHeaders

bool ShowRowColHeaders { get; set; }

Property Value

bool

ShowRuler

bool ShowRuler { get; set; }

Property Value

bool

ShowWhiteSpace

bool ShowWhiteSpace { get; set; }

Property Value

bool

ShowZeros

bool ShowZeros { get; set; }

Property Value

bool

Style

Gets or sets the default style for the workbook.

All new worksheets will use this style.

IXLStyle Style { get; set; }

Property Value

IXLStyle

Theme

Gets an object to manipulate this workbook's theme.

IXLTheme Theme { get; }

Property Value

IXLTheme

Use1904DateSystem

bool Use1904DateSystem { get; set; }

Property Value

bool

Worksheets

Gets an object to manipulate the worksheets.

IXLWorksheets Worksheets { get; }

Property Value

IXLWorksheets

Methods

AddChartsheet()

IXLChartsheet AddChartsheet()

Returns

IXLChartsheet

AddChartsheet(int)

IXLChartsheet AddChartsheet(int position)

Parameters

position int

Returns

IXLChartsheet

AddChartsheet(string)

IXLChartsheet AddChartsheet(string sheetName)

Parameters

sheetName string

Returns

IXLChartsheet

AddChartsheet(string, int)

IXLChartsheet AddChartsheet(string sheetName, int position)

Parameters

sheetName string
position int

Returns

IXLChartsheet

AddWorksheet()

IXLWorksheet AddWorksheet()

Returns

IXLWorksheet

AddWorksheet(IXLWorksheet)

void AddWorksheet(IXLWorksheet worksheet)

Parameters

worksheet IXLWorksheet

AddWorksheet(DataSet)

void AddWorksheet(DataSet dataSet)

Parameters

dataSet DataSet

AddWorksheet(DataTable)

Add a worksheet with a table at Cell(row:1, column:1). The dataTable's name is used for the worksheet name. The name of a table will be generated as Table{number suffix}.

IXLWorksheet AddWorksheet(DataTable dataTable)

Parameters

dataTable DataTable

Datatable to insert

Returns

IXLWorksheet

Inserted Worksheet

AddWorksheet(DataTable, string)

Add a worksheet with a table at Cell(row:1, column:1). The sheetName provided is used for the worksheet name. The name of a table will be generated as Table{number suffix}.

IXLWorksheet AddWorksheet(DataTable dataTable, string sheetName)

Parameters

dataTable DataTable

dataTable to insert as Excel Table

sheetName string

Worksheet and Excel Table name

Returns

IXLWorksheet

Inserted Worksheet

AddWorksheet(DataTable, string, string)

Add a worksheet with a table at Cell(row:1, column:1).

IXLWorksheet AddWorksheet(DataTable dataTable, string sheetName, string tableName)

Parameters

dataTable DataTable

dataTable to insert as Excel Table

sheetName string

Worksheet name

tableName string

Excel Table name

Returns

IXLWorksheet

Inserted Worksheet

AddWorksheet(int)

IXLWorksheet AddWorksheet(int position)

Parameters

position int

Returns

IXLWorksheet

AddWorksheet(string)

IXLWorksheet AddWorksheet(string sheetName)

Parameters

sheetName string

Returns

IXLWorksheet

AddWorksheet(string, int)

IXLWorksheet AddWorksheet(string sheetName, int position)

Parameters

sheetName string
position int

Returns

IXLWorksheet

Cell(string)

IXLCell Cell(string namedCell)

Parameters

namedCell string

Returns

IXLCell

Cells(string)

IXLCells Cells(string namedCells)

Parameters

namedCells string

Returns

IXLCells

Chartsheet(int)

IXLChartsheet Chartsheet(int position)

Parameters

position int

Returns

IXLChartsheet

Chartsheet(string)

IXLChartsheet Chartsheet(string name)

Parameters

name string

Returns

IXLChartsheet

CustomProperty(string)

IXLCustomProperty CustomProperty(string name)

Parameters

name string

Returns

IXLCustomProperty

Evaluate(string)

Evaluate a formula expression.

XLCellValue Evaluate(string expression)

Parameters

expression string

Formula expression to evaluate.

Returns

XLCellValue

Exceptions

MissingContextException

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

FindCells(Func<IXLCell, bool>)

IXLCells FindCells(Func<IXLCell, bool> predicate)

Parameters

predicate Func<IXLCell, bool>

Returns

IXLCells

FindColumns(Func<IXLColumn, bool>)

IXLColumns FindColumns(Func<IXLColumn, bool> predicate)

Parameters

predicate Func<IXLColumn, bool>

Returns

IXLColumns

FindRows(Func<IXLRow, bool>)

IXLRows FindRows(Func<IXLRow, bool> predicate)

Parameters

predicate Func<IXLRow, bool>

Returns

IXLRows

NamedRange(string)

IXLNamedRange NamedRange(string rangeName)

Parameters

rangeName string

Returns

IXLNamedRange

Range(string)

IXLRange Range(string range)

Parameters

range string

Returns

IXLRange

RangeFromFullAddress(string, out IXLWorksheet)

IXLRange RangeFromFullAddress(string rangeAddress, out IXLWorksheet ws)

Parameters

rangeAddress string
ws IXLWorksheet

Returns

IXLRange

Ranges(string)

IXLRanges Ranges(string ranges)

Parameters

ranges string

Returns

IXLRanges

RecalculateAllFormulas()

Force recalculation of all cell formulas.

void RecalculateAllFormulas()

Save()

Saves the current workbook.

void Save()

Save(SaveOptions)

void Save(SaveOptions options)

Parameters

options SaveOptions

Save(bool, bool)

Saves the current workbook and optionally performs validation

void Save(bool validate, bool evaluateFormulae = false)

Parameters

validate bool
evaluateFormulae bool

SaveAs(Stream)

Saves the current workbook to a stream.

void SaveAs(Stream stream)

Parameters

stream Stream

SaveAs(Stream, SaveOptions)

void SaveAs(Stream stream, SaveOptions options)

Parameters

stream Stream
options SaveOptions

SaveAs(Stream, bool, bool)

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

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

Parameters

stream Stream
validate bool
evaluateFormulae bool

SaveAs(string)

Saves the current workbook to a file.

void SaveAs(string file)

Parameters

file string

SaveAs(string, SaveOptions)

void SaveAs(string file, SaveOptions options)

Parameters

file string
options SaveOptions

SaveAs(string, bool, bool)

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

void SaveAs(string file, bool validate, bool evaluateFormulae = false)

Parameters

file string
validate bool
evaluateFormulae bool

Search(string, CompareOptions, bool)

Searches the cells' contents for a given piece of text

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

Parameters

searchText string

The search text.

compareOptions CompareOptions

The compare options.

searchFormulae bool

if set to true search formulae instead of cell values.

Returns

IEnumerable<IXLCell>

SetLockStructure(bool)

XLWorkbook SetLockStructure(bool value)

Parameters

value bool

Returns

XLWorkbook

SetLockWindows(bool)

XLWorkbook SetLockWindows(bool value)

Parameters

value bool

Returns

XLWorkbook

SetUse1904DateSystem()

XLWorkbook SetUse1904DateSystem()

Returns

XLWorkbook

SetUse1904DateSystem(bool)

XLWorkbook SetUse1904DateSystem(bool value)

Parameters

value bool

Returns

XLWorkbook

Sheet(int)

IXLSheet Sheet(int position)

Parameters

position int

Returns

IXLSheet

Sheet(string)

IXLSheet Sheet(string name)

Parameters

name string

Returns

IXLSheet

Table(string, StringComparison)

Gets the Excel table of the given name

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

Parameters

tableName string

Name of the table to return.

comparisonType StringComparison

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

Returns

IXLTable

The table with given name

Exceptions

ArgumentOutOfRangeException

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

TryGetChartsheet(string, out IXLChartsheet)

bool TryGetChartsheet(string name, out IXLChartsheet worksheet)

Parameters

name string
worksheet IXLChartsheet

Returns

bool

TryGetSheet(string, out IXLSheet)

bool TryGetSheet(string name, out IXLSheet worksheet)

Parameters

name string
worksheet IXLSheet

Returns

bool

TryGetWorksheet(string, out IXLWorksheet)

bool TryGetWorksheet(string name, out IXLWorksheet worksheet)

Parameters

name string
worksheet IXLWorksheet

Returns

bool

Worksheet(int)

IXLWorksheet Worksheet(int position)

Parameters

position int

Returns

IXLWorksheet

Worksheet(string)

IXLWorksheet Worksheet(string name)

Parameters

name string

Returns

IXLWorksheet