ClassWorkbook
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:
public class Workbook : NotifyPropertyChangedBase, INotifyPropertyChanged, IDisposable
Inheritance: objectNotifyPropertyChangedBaseWorkbook
Implements:
Inherited Members
Constructors
Workbook()
Initializes a new Workbook with default settings and an empty sheet collection.
Declaration
public Workbook()
Properties
ActiveSheet
Gets or sets the sheet currently selected for viewing and editing.
Declaration
public Sheet ActiveSheet { get; set; }
Property Value
The active sheet.
ActiveTabIndex
Gets or sets the zero-based index of the currently selected sheet tab.
Declaration
public int ActiveTabIndex { get; set; }
Property Value
The index of the active tab.
ActiveWorksheet
Gets or sets the data worksheet currently selected, returning null if the active sheet is not a worksheet.
Declaration
public Worksheet ActiveWorksheet { get; set; }
Property Value
The active worksheet.
DocumentInfo
Gets or sets the document metadata such as title, author, subject, and keywords.
Declaration
public DocumentInfo DocumentInfo { get; set; }
Property Value
The document information.
History
Gets the undo/redo history for tracking and reversing user modifications.
Declaration
public WorkbookHistory History { get; }
Property Value
The history for this workbook.
IsLayoutUpdateSuspended
Gets whether layout recalculation is temporarily disabled for batch modifications.
Declaration
public bool IsLayoutUpdateSuspended { get; }
Property Value
The value indicating whether the layout update is suspended.
IsProtected
Gets whether the workbook structure is password-protected, preventing sheet additions, deletions, or reordering.
Declaration
public bool IsProtected { get; }
Property Value
The is protected.
Name
Gets or sets the document name, typically displayed in the application title bar.
Declaration
public string Name { get; set; }
Property Value
The name of the workbook.
Names
Gets the workbook-scoped named ranges and formulas accessible across all sheets.
Declaration
public NameCollection Names { get; }
Property Value
The collection of defined names of the workbook.
Sheets
Gets all sheets in the workbook, including worksheets and chart sheets.
Declaration
public SheetCollection Sheets { get; }
Property Value
The sheets of the workbook.
Styles
Gets the named cell styles that can be applied to cells throughout the workbook.
Declaration
public CellStyleCollection Styles { get; }
Property Value
The collection of styles for this workbook.
Theme
Gets or sets the color scheme and font theme applied to themable elements throughout the workbook.
Declaration
public DocumentTheme Theme { get; set; }
Property Value
The workbook theme.
WorkbookContentChangedInterval
Gets or sets the throttling interval for WorkbookContentChanged event notifications to reduce event frequency during rapid edits.
Declaration
public TimeSpan WorkbookContentChangedInterval { get; set; }
Property Value
The interval on which the workbook content changes.
Worksheets
Gets the data worksheets, excluding chart sheets and other sheet types.
Declaration
public WorksheetCollection Worksheets { get; }
Property Value
The worksheets of the workbook.
Methods
CallOnWorkbookContentChanged()
Schedules the WorkbookContentChanged event to fire after the throttling interval.
Declaration
protected void CallOnWorkbookContentChanged()
Dispose()
Releases all resources used by the workbook.
Declaration
public void Dispose()
Implements
Dispose(bool)
Releases resources, optionally disposing managed objects.
Declaration
protected virtual void Dispose(bool cleanUpManagedResources)
Parameters
cleanUpManagedResources
The clean up managed resources.
Find(FindOptions)
Searches for the next occurrence matching the specified criteria and returns its location, or null if not found.
Declaration
public FindResult Find(FindOptions findOptions)
Parameters
findOptions
The find options.
Returns
The find results.
FindAll(FindOptions)
Searches for all occurrences matching the specified criteria and returns their locations.
Declaration
public IEnumerable<FindResult> FindAll(FindOptions findOptions)
Parameters
findOptions
The find options.
Returns
The find results.
OnActiveSheetChanged()
Called when the active sheet is changed.
Declaration
protected virtual void OnActiveSheetChanged()
OnCommandError(CommandErrorEventArgs)
Raises the event.
Declaration
protected virtual void OnCommandError(CommandErrorEventArgs args)
Parameters
args
The CommandErrorEventArgs instance containing the event data.
OnCommandExecuted(CommandExecutedEventArgs)
Raises the event, recording the command in history if undoable.
Declaration
protected virtual void OnCommandExecuted(CommandExecutedEventArgs args)
Parameters
args
The CommandExecutedEventArgs instance containing the event data.
OnCommandExecuting(CommandExecutingEventArgs)
Raises the event, iterating handlers until one sets Canceled.
Declaration
protected virtual void OnCommandExecuting(CommandExecutingEventArgs args)
Parameters
args
The CommandExecutingEventArgs instance containing the event data.
OnIsProtectedChanged()
Called when [is protected changed].
Declaration
protected virtual void OnIsProtectedChanged()
OnThemeChanged()
Called when [theme changed].
Declaration
protected virtual void OnThemeChanged()
OnWorkbookContentChanged()
Called when [workbook content changed].
Declaration
protected virtual void OnWorkbookContentChanged()
Protect(string)
Protects the workbook structure with a password, preventing sheet additions, deletions, and reordering.
Declaration
public void Protect(string password)
Parameters
password
The password.
Replace(ReplaceOptions)
Replaces the next occurrence in the active worksheet matching the specified criteria and returns whether a replacement was made.
Declaration
public bool Replace(ReplaceOptions replaceOptions)
Parameters
replaceOptions
The replace options.
Returns
The value indicating whether a value was found to replace.
ReplaceAll(ReplaceOptions)
Replaces all occurrences matching the specified criteria and returns the count of replacements made.
Declaration
public int ReplaceAll(ReplaceOptions replaceOptions)
Parameters
replaceOptions
The replace options.
Returns
The number of replacements made.
ResumeLayoutUpdate()
Re-enables layout recalculation and triggers an update if modifications occurred while suspended.
Declaration
public void ResumeLayoutUpdate()
SuspendLayoutUpdate()
Temporarily disables layout recalculation to improve performance during batch modifications; call ResumeLayoutUpdate when complete.
Declaration
public void SuspendLayoutUpdate()
Unprotect(string)
Removes workbook structure protection using the specified password and returns whether the password was correct.
Events
ActiveSheetChanged
Raised when the user selects a different sheet.
CommandError
Raised when a command encounters an error during execution.
Declaration
public event EventHandler<CommandErrorEventArgs> CommandError
Event Value
CommandExecuted
Raised after a command successfully completes execution.
Declaration
public event EventHandler<CommandExecutedEventArgs> CommandExecuted
Event Value
CommandExecuting
Raised before a command executes, allowing cancellation via the event args.
Declaration
public event EventHandler<CommandExecutingEventArgs> CommandExecuting
Event Value
IsProtectedChanged
Raised when the workbook's protection state changes between protected and unprotected.
NameChanged
Raised when the workbook's name property changes.
ThemeChanged
Raised when the workbook's theme is changed.
WorkbookContentChanged
Raised when any content changes, throttled according to WorkbookContentChangedInterval.
Declaration
public event EventHandler WorkbookContentChanged
Event Value