Class Workbook
The top-level container for an Excel-compatible spreadsheet document, managing sheets, styles, history, and document-wide settings.
Inherited Members
Namespace: Telerik.Windows.Documents.Spreadsheet.Model
Assembly: Telerik.Windows.Documents.Spreadsheet.dll
Syntax
public class Workbook : NotifyPropertyChangedBase, INotifyPropertyChanged, IDisposable
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
|
Sheet
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
|
System.Int32
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
|
Worksheet
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
|
DocumentInfo
The document information. |
History
Gets the undo/redo history for tracking and reversing user modifications.
Declaration
public WorkbookHistory History { get; }
Property Value
|
WorkbookHistory
The history for this workbook. |
IsLayoutUpdateSuspended
Gets whether layout recalculation is temporarily disabled for batch modifications.
Declaration
public bool IsLayoutUpdateSuspended { get; }
Property Value
|
System.Boolean
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
|
System.Boolean
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
|
System.String
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
|
NameCollection
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
|
SheetCollection
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
|
CellStyleCollection
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
|
DocumentTheme
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
|
System.TimeSpan
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
|
WorksheetCollection
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(Boolean)
Releases resources, optionally disposing managed objects.
Declaration
protected virtual void Dispose(bool cleanUpManagedResources)
Parameters
|
System.Boolean
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
findOptions
The find options. |
Returns
|
FindResult
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
findOptions
The find options. |
Returns
|
System.Collections.Generic.IEnumerable<FindResult>
The find results. |
OnActiveSheetChanged()
Called when the active sheet is changed.
Declaration
protected virtual void OnActiveSheetChanged()
OnCommandError(CommandErrorEventArgs)
Raises the CommandError event.
Declaration
protected virtual void OnCommandError(CommandErrorEventArgs args)
Parameters
|
CommandErrorEventArgs
args
The CommandErrorEventArgs instance containing the event data. |
OnCommandExecuted(CommandExecutedEventArgs)
Raises the CommandExecuted event, recording the command in history if undoable.
Declaration
protected virtual void OnCommandExecuted(CommandExecutedEventArgs args)
Parameters
|
CommandExecutedEventArgs
args
The CommandExecutedEventArgs instance containing the event data. |
OnCommandExecuting(CommandExecutingEventArgs)
Raises the CommandExecuting event, iterating handlers until one sets Canceled.
Declaration
protected virtual void OnCommandExecuting(CommandExecutingEventArgs args)
Parameters
|
CommandExecutingEventArgs
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
|
System.String
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
replaceOptions
The replace options. |
Returns
|
System.Boolean
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
replaceOptions
The replace options. |
Returns
|
System.Int32
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.
Declaration
public bool Unprotect(string password)
Parameters
|
System.String
password
The password. |
Returns
|
System.Boolean
|
Events
ActiveSheetChanged
Raised when the user selects a different sheet.
Declaration
public event EventHandler ActiveSheetChanged
Event Type
|
System.EventHandler
|
CommandError
Raised when a command encounters an error during execution.
Declaration
public event EventHandler<CommandErrorEventArgs> CommandError
Event Type
|
System.EventHandler<CommandErrorEventArgs>
|
CommandExecuted
Raised after a command successfully completes execution.
Declaration
public event EventHandler<CommandExecutedEventArgs> CommandExecuted
Event Type
|
System.EventHandler<CommandExecutedEventArgs>
|
CommandExecuting
Raised before a command executes, allowing cancellation via the event args.
Declaration
public event EventHandler<CommandExecutingEventArgs> CommandExecuting
Event Type
|
System.EventHandler<CommandExecutingEventArgs>
|
IsProtectedChanged
Raised when the workbook's protection state changes between protected and unprotected.
Declaration
public event EventHandler IsProtectedChanged
Event Type
|
System.EventHandler
|
NameChanged
Raised when the workbook's name property changes.
Declaration
public event EventHandler NameChanged
Event Type
|
System.EventHandler
|
ThemeChanged
Raised when the workbook's theme is changed.
Declaration
public event EventHandler ThemeChanged
Event Type
|
System.EventHandler
|
WorkbookContentChanged
Raised when any content changes, throttled according to WorkbookContentChangedInterval.
Declaration
public event EventHandler WorkbookContentChanged
Event Type
|
System.EventHandler
|