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