Class RadSpreadsheet
Represents a comprehensive spreadsheet control that provides Excel-like functionality for viewing, editing, and manipulating workbook data with support for multiple worksheets, formulas, formatting, and data operations. This control serves as the main container for spreadsheet functionality and can be seamlessly integrated with a RadSpreadsheetRibbonBar to provide a complete ribbon-based user interface with comprehensive editing commands, formatting options, and spreadsheet operations.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.RadSpreadsheet.dll
Syntax
[TelerikToolboxCategory("Spreadsheet")]
public class RadSpreadsheet : RadControl, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IPCHost, IAnalyticsProvider, IPrintable
Remarks
The RadSpreadsheet control internally uses a RadSpreadsheetElement to provide core spreadsheet functionality including worksheet editing, formula calculation, data import/export, and printing capabilities. When used in conjunction with RadSpreadsheetRibbonBar, it offers a complete spreadsheet solution with familiar ribbon-style user interface for advanced spreadsheet operations.
Constructors
RadSpreadsheet()
Declaration
public RadSpreadsheet()
Fields
DEFAULT_NAMESPACE
Declaration
public static readonly string DEFAULT_NAMESPACE
Field Value
System.String
|
Properties
ActiveSheet
Gets or sets the currently active sheet in the spreadsheet workbook.
Declaration
public Sheet ActiveSheet { get; set; }
Property Value
Sheet
|
ActiveWorksheet
Gets or sets the currently active worksheet in the spreadsheet, which is the worksheet that is currently displayed and available for editing.
Declaration
public Worksheet ActiveWorksheet { get; set; }
Property Value
Worksheet
|
ActiveWorksheetEditor
Gets or sets the editor for the currently active worksheet, providing access to editing operations on the worksheet content.
Declaration
public RadWorksheetEditor ActiveWorksheetEditor { get; set; }
Property Value
RadWorksheetEditor
|
AutoSize
The property is not relevant for this control.
Declaration
public override bool AutoSize { get; set; }
Property Value
System.Boolean
|
Overrides
DefaultSize
Gets the default size of the spreadsheet control.
Declaration
protected override Size DefaultSize { get; }
Property Value
System.Drawing.Size
A Size value representing the default dimensions of the control. |
Dispatcher
Gets the dispatcher for this spreadsheet control, which allows scheduling of operations that need to be executed on the UI thread.
Declaration
public Dispatcher Dispatcher { get; }
Property Value
Dispatcher
|
InputHandler
Gets or sets an instance of SpreadsheetInputBehavior that handles all user input including keyboard navigation, selection, and cell editing operations.
Declaration
public SpreadsheetInputBehavior InputHandler { get; set; }
Property Value
SpreadsheetInputBehavior
|
SpreadsheetElement
Gets the RadSpreadsheetElement of this control, which contains the core UI components and functionality of the spreadsheet.
Declaration
public RadSpreadsheetElement SpreadsheetElement { get; }
Property Value
RadSpreadsheetElement
|
Text
This property is not relevant for this class.
Declaration
public override string Text { get; set; }
Property Value
System.String
|
Overrides
Workbook
Gets or sets the workbook that contains the spreadsheet data and worksheets. The workbook is the top-level container for all data, worksheets, and formatting in the spreadsheet.
Declaration
public Workbook Workbook { get; set; }
Property Value
Workbook
|
Methods
BeginUndoGroup()
Begins an undo group that allows multiple operations to be undone as a single action. Use in conjunction with EndUndoGroup() to group related operations.
Declaration
public void BeginUndoGroup()
CancelUndoGroup()
Cancels the currently active undo group, discarding all operations that would have been grouped since the last call to BeginUndoGroup().
Declaration
public void CancelUndoGroup()
CreateBehavior()
Creates the input behavior component for the RadSpreadsheet control.
Declaration
protected override ComponentInputBehavior CreateBehavior()
Returns
ComponentInputBehavior
A new instance of RadSpreadsheetComponentInputBehavior configured for this spreadsheet. |
Overrides
CreateChildItems(RadElement)
Declaration
protected override void CreateChildItems(RadElement parent)
Parameters
RadElement
parent
|
Overrides
CreateSpreadsheetElement()
Declaration
protected virtual RadSpreadsheetElement CreateSpreadsheetElement()
Returns
RadSpreadsheetElement
|
EndUndoGroup()
Ends the currently active undo group, finalizing the grouping of operations since the last call to BeginUndoGroup().
Declaration
public void EndUndoGroup()
IsInputKey(Keys)
Determines whether the specified key is an input key that the spreadsheet should process, rather than a key that the form should process.
Declaration
protected override bool IsInputKey(Keys keyData)
Parameters
System.Windows.Forms.Keys
keyData
One of the Keys values representing the key to check. |
Returns
System.Boolean
True if the specified key is an input key; otherwise, false. |
Overrides
OnKeyDown(KeyEventArgs)
Raises the KeyDown event and processes keyboard input for the spreadsheet control.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
System.Windows.Forms.KeyEventArgs
e
A KeyEventArgs that contains the event data. |
Overrides
OnKeyPress(KeyPressEventArgs)
Raises the KeyPress event and processes character input for the spreadsheet control.
Declaration
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
System.Windows.Forms.KeyPressEventArgs
e
A KeyPressEventArgs that contains the event data. |
Overrides
OnKeyUp(KeyEventArgs)
Raises the KeyUp event and processes the key release event for the spreadsheet control.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
System.Windows.Forms.KeyEventArgs
e
A KeyEventArgs that contains the event data. |
Overrides
OnMouseWheel(MouseEventArgs)
Raises the MouseWheel event and processes mouse wheel scrolling for the spreadsheet control.
Declaration
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
System.Windows.Forms.MouseEventArgs
e
A MouseEventArgs that contains the event data. |
Overrides
OnThemeChanged()
Raises the ThemeChanged event and updates visual elements to reflect the new theme.
Declaration
protected override void OnThemeChanged()
Overrides
Print(PrintWhatSettings, String, Boolean)
Prints the spreadsheet content using the specified print settings and optional description.
Declaration
public void Print(PrintWhatSettings printSettings, string printDescription = null, bool showDialog = true)
Parameters
PrintWhatSettings
printSettings
The settings that determine what content should be printed, such as specific worksheets or selection. |
System.String
printDescription
Optional description text that appears in the print preview and printed output. |
System.Boolean
showDialog
When true, displays the print dialog before printing; when false, prints directly with current settings. |
PrintPreview()
Shows a print preview dialog that allows the user to view how the spreadsheet will look when printed and make adjustments to print settings before printing.
Declaration
public void PrintPreview()
ProcessDialogChar(Char)
Processes a dialog character, which is a character that is processed by the active form's dialog box. Overridden to handle character input with modifier keys for the spreadsheet.
Declaration
protected override bool ProcessDialogChar(char charCode)
Parameters
System.Char
charCode
The character to process. |
Returns
System.Boolean
True if the character was processed by the control; otherwise, false. |
ProcessDialogKey(Keys)
Processes a dialog key, which is a key that is processed by the active form's dialog box. Overridden to handle Enter key specially for the spreadsheet.
Declaration
protected override bool ProcessDialogKey(Keys keyData)
Parameters
System.Windows.Forms.Keys
keyData
One of the Keys values representing the key to process. |
Returns
System.Boolean
True if the key was processed; otherwise, false. |
ProcessMnemonic(Char)
Processes a mnemonic character, which is a character used to select menu items or controls by keyboard. Overridden to customize mnemonic handling for the spreadsheet.
Declaration
protected override bool ProcessMnemonic(char charCode)
Parameters
System.Char
charCode
The character to process. |
Returns
System.Boolean
True if the character was processed as a mnemonic by the control; otherwise, false. |
Overrides
Redo()
Redoes the most recently undone operation or group of operations in the spreadsheet.
Declaration
public bool Redo()
Returns
System.Boolean
True if the redo operation succeeded; otherwise, false. |
Undo()
Undoes the most recent operation or group of operations in the spreadsheet.
Declaration
public bool Undo()
Returns
System.Boolean
True if the undo operation succeeded; otherwise, false. |
Events
BeforeOpenFile
Occurs before a file is opened, before the open file dialog is shown.
Declaration
public event EventHandler<OpenFileDialogEventArgs> BeforeOpenFile
Event Type
System.EventHandler<OpenFileDialogEventArgs>
|
Remarks
Subscribe to this event to customize the OpenFileDialog properties (like Filter, InitialDirectory, etc.) before it is displayed to the user. Handlers can also cancel the open file operation by setting the Cancel property of the event arguments to true.
BeforeSaveFile
Occurs before the file is saved, before the save file dialog is shown.
Declaration
public event EventHandler<SaveFileDialogEventArgs> BeforeSaveFile
Event Type
System.EventHandler<SaveFileDialogEventArgs>
|
Remarks
Subscribe to this event to customize the SaveFileDialog properties (like Filter, InitialDirectory, etc.) before it is displayed to the user. Handlers can also cancel the open file operation by setting the Cancel property of the event arguments to true.
Explicit Interface Implementations
IPrintable.BeginPrint(RadPrintDocument, PrintEventArgs)
Begins the print operation for the spreadsheet content.
Declaration
int IPrintable.BeginPrint(RadPrintDocument sender, PrintEventArgs args)
Parameters
RadPrintDocument
sender
The RadPrintDocument that is initiating the print operation. |
System.Drawing.Printing.PrintEventArgs
args
A PrintEventArgs that contains the event data. |
Returns
System.Int32
The number of pages to be printed. |
Implements
IPrintable.EndPrint(RadPrintDocument, PrintEventArgs)
Completes the print operation for the spreadsheet content.
Declaration
bool IPrintable.EndPrint(RadPrintDocument sender, PrintEventArgs args)
Parameters
RadPrintDocument
sender
The RadPrintDocument that is finishing the print operation. |
System.Drawing.Printing.PrintEventArgs
args
A PrintEventArgs that contains the event data. |
Returns
System.Boolean
True if the end print operation was successful; otherwise, false. |
Implements
IPrintable.GetSettingsDialog(RadPrintDocument)
Gets a dialog form for configuring print settings for the spreadsheet.
Declaration
Form IPrintable.GetSettingsDialog(RadPrintDocument document)
Parameters
RadPrintDocument
document
The RadPrintDocument for which to get the settings dialog. |
Returns
System.Windows.Forms.Form
A Form containing print settings controls specific to the spreadsheet. |
Implements
IPrintable.PrintPage(Int32, RadPrintDocument, PrintPageEventArgs)
Prints a specific page of the spreadsheet content.
Declaration
bool IPrintable.PrintPage(int pageNumber, RadPrintDocument sender, PrintPageEventArgs args)
Parameters
System.Int32
pageNumber
The page number to print (zero-based). |
RadPrintDocument
sender
The RadPrintDocument that is printing the page. |
System.Drawing.Printing.PrintPageEventArgs
args
A PrintPageEventArgs that contains the event data. |
Returns
System.Boolean
True if the page was successfully printed; otherwise, false. |