New to Telerik Document ProcessingStart a free 30-day trial

The top-level container for an Excel-compatible spreadsheet document, managing sheets, styles, history, and document-wide settings.

Definition

Namespace:Telerik.Windows.Documents.Spreadsheet.Model

Assembly:Telerik.Windows.Documents.Spreadsheet.dll

Syntax:

C#
public class Workbook : NotifyPropertyChangedBase, INotifyPropertyChanged, IDisposable

Inheritance: objectNotifyPropertyChangedBaseWorkbook

Implements: IDisposableINotifyPropertyChanged

Inherited Members NotifyPropertyChangedBase.OnPropertyChanged(string)NotifyPropertyChangedBase.OnPropertyChanged(PropertyChangedEventArgs)NotifyPropertyChangedBase.PropertyChanged

Constructors

Initializes a new Workbook with default settings and an empty sheet collection.

C#
public Workbook()

Events

Raised when the user selects a different sheet.

C#
public event EventHandler ActiveSheetChanged

Raised when a command encounters an error during execution.

C#
public event EventHandler<CommandErrorEventArgs> CommandError

Raised after a command successfully completes execution.

C#
public event EventHandler<CommandExecutedEventArgs> CommandExecuted

Raised before a command executes, allowing cancellation via the event args.

C#
public event EventHandler<CommandExecutingEventArgs> CommandExecuting

Raised when the workbook's protection state changes between protected and unprotected.

C#
public event EventHandler IsProtectedChanged

Raised when the workbook's name property changes.

C#
public event EventHandler NameChanged

Raised when the workbook's theme is changed.

C#
public event EventHandler ThemeChanged

Raised when any content changes, throttled according to WorkbookContentChangedInterval.

C#
public event EventHandler WorkbookContentChanged

Methods

Schedules the WorkbookContentChanged event to fire after the throttling interval.

C#
protected void CallOnWorkbookContentChanged()

Releases all resources used by the workbook.

C#
public void Dispose()

Implements: IDisposable.Dispose()

Releases resources, optionally disposing managed objects.

C#
protected virtual void Dispose(bool cleanUpManagedResources)
Parameters:cleanUpManagedResourcesbool

The clean up managed resources.

Searches for the next occurrence matching the specified criteria and returns its location, or null if not found.

C#
public FindResult Find(FindOptions findOptions)
Parameters:findOptionsFindOptions

The find options.

Returns:

FindResult

The find results.

Searches for all occurrences matching the specified criteria and returns their locations.

C#
public IEnumerable<FindResult> FindAll(FindOptions findOptions)
Parameters:findOptionsFindOptions

The find options.

Returns:

IEnumerable<FindResult>

The find results.

Called when the active sheet is changed.

C#
protected virtual void OnActiveSheetChanged()

Raises the event.

C#
protected virtual void OnCommandError(CommandErrorEventArgs args)
Parameters:argsCommandErrorEventArgs

The CommandErrorEventArgs instance containing the event data.

Raises the event, recording the command in history if undoable.

C#
protected virtual void OnCommandExecuted(CommandExecutedEventArgs args)
Parameters:argsCommandExecutedEventArgs

The CommandExecutedEventArgs instance containing the event data.

Raises the event, iterating handlers until one sets Canceled.

C#
protected virtual void OnCommandExecuting(CommandExecutingEventArgs args)
Parameters:argsCommandExecutingEventArgs

The CommandExecutingEventArgs instance containing the event data.

Called when [is protected changed].

C#
protected virtual void OnIsProtectedChanged()

Called when [theme changed].

C#
protected virtual void OnThemeChanged()

Called when [workbook content changed].

C#
protected virtual void OnWorkbookContentChanged()

Protects the workbook structure with a password, preventing sheet additions, deletions, and reordering.

C#
public void Protect(string password)
Parameters:passwordstring

The password.

Replaces the next occurrence in the active worksheet matching the specified criteria and returns whether a replacement was made.

C#
public bool Replace(ReplaceOptions replaceOptions)
Parameters:replaceOptionsReplaceOptions

The replace options.

Returns:

bool

The value indicating whether a value was found to replace.

Replaces all occurrences matching the specified criteria and returns the count of replacements made.

C#
public int ReplaceAll(ReplaceOptions replaceOptions)
Parameters:replaceOptionsReplaceOptions

The replace options.

Returns:

int

The number of replacements made.

Re-enables layout recalculation and triggers an update if modifications occurred while suspended.

C#
public void ResumeLayoutUpdate()

Temporarily disables layout recalculation to improve performance during batch modifications; call ResumeLayoutUpdate when complete.

C#
public void SuspendLayoutUpdate()

Removes workbook structure protection using the specified password and returns whether the password was correct.

C#
public bool Unprotect(string password)
Parameters:passwordstring

The password.

Returns:

bool

Properties

Gets or sets the sheet currently selected for viewing and editing.

C#
public Sheet ActiveSheet { get; set; }
Property Value:

The active sheet.

Gets or sets the zero-based index of the currently selected sheet tab.

C#
public int ActiveTabIndex { get; set; }
Property Value:

The index of the active tab.

Gets or sets the data worksheet currently selected, returning null if the active sheet is not a worksheet.

C#
public Worksheet ActiveWorksheet { get; set; }
Property Value:

The active worksheet.

Gets or sets the document metadata such as title, author, subject, and keywords.

C#
public DocumentInfo DocumentInfo { get; set; }
Property Value:

The document information.

Gets the undo/redo history for tracking and reversing user modifications.

C#
public WorkbookHistory History { get; }
Property Value:

The history for this workbook.

Gets whether layout recalculation is temporarily disabled for batch modifications.

C#
public bool IsLayoutUpdateSuspended { get; }
Property Value:

The value indicating whether the layout update is suspended.

Gets whether the workbook structure is password-protected, preventing sheet additions, deletions, or reordering.

C#
public bool IsProtected { get; }
Property Value:

The is protected.

Gets or sets the document name, typically displayed in the application title bar.

C#
public string Name { get; set; }
Property Value:

The name of the workbook.

Gets the workbook-scoped named ranges and formulas accessible across all sheets.

C#
public NameCollection Names { get; }
Property Value:

The collection of defined names of the workbook.

Gets all sheets in the workbook, including worksheets and chart sheets.

C#
public SheetCollection Sheets { get; }
Property Value:

The sheets of the workbook.

Gets the named cell styles that can be applied to cells throughout the workbook.

C#
public CellStyleCollection Styles { get; }
Property Value:

The collection of styles for this workbook.

Gets or sets the color scheme and font theme applied to themable elements throughout the workbook.

C#
public DocumentTheme Theme { get; set; }
Property Value:

The workbook theme.

Gets or sets the throttling interval for WorkbookContentChanged event notifications to reduce event frequency during rapid edits.

C#
public TimeSpan WorkbookContentChangedInterval { get; set; }
Property Value:

The interval on which the workbook content changes.

Gets the data worksheets, excluding chart sheets and other sheet types.

C#
public WorksheetCollection Worksheets { get; }
Property Value:

The worksheets of the workbook.

Extension Methods