SpreadsheetGrid Class
Represents a class which is used for displaying the data of IWorksheet.
Inherited Members
Namespace: Syncfusion.Windows.Forms.Spreadsheet
Assembly: Syncfusion.Spreadsheet.Windows.dll
Syntax
public class SpreadsheetGrid : SfCellGrid, ICalcData, INotifyPropertyChanged, IDisposable
Remarks
The data will be displayed in the form of rows and columns. This class also includes the selection and editing operations in grid that allow the users to easily manage the data.
Constructors
SpreadsheetGrid()
Initializes a new instance of the SpreadsheetGrid class.
Declaration
public SpreadsheetGrid()
Properties
CellRenderers
Gets a value indicating the instance of SpreadsheetCellRendererCollection which holds the collection of cellrenderer objects.
Declaration
public SpreadsheetCellRendererCollection CellRenderers { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetCellRendererCollection | An instance of SpreadsheetCellRendererCollection. |
ColumnGroupPanel
Gets or sets the Panel used for Column Grouping
Declaration
public OutlinesPanel ColumnGroupPanel { get; set; }
Property Value
| Type |
|---|
| OutlinesPanel |
CreateParams
Used this to avoid the flickering in formula bar when open and close the backstage.
Declaration
protected override CreateParams CreateParams { get; }
Property Value
| Type |
|---|
| System.Windows.Forms.CreateParams |
CurrentCell
Gets the value indicating the instance of the SpreadsheetCurrentCell which maintains the current cell in SpreadsheetGrid.
Declaration
public SpreadsheetCurrentCell CurrentCell { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetCurrentCell | An instance of SpreadsheetCurrentCell. |
FillSeriesController
Gets or sets the value indicating the instance of FillSeriesController which provides support to autofill the data.
Declaration
public FillSeriesController FillSeriesController { get; set; }
Property Value
| Type | Description |
|---|---|
| FillSeriesController | An instance of FillSeriesController. |
GraphicModel
Gets the value indicating the instance of GraphicModel which holds all the information about graphic cells.
Declaration
public GraphicModel GraphicModel { get; }
Property Value
| Type | Description |
|---|---|
| GraphicModel | An instance of GraphicModel. |
Model
Gets the value indicating the instance of SpreadsheetGridModel which holds the operation on rows and columns in SpreadsheetGrid.
Declaration
public SpreadsheetGridModel Model { get; }
Property Value
| Type | Description |
|---|---|
| SpreadsheetGridModel | An instance of SpreadsheetGridModel |
RowGroupPanel
Gets or sets the Panel used for Row Grouping
Declaration
public OutlinesPanel RowGroupPanel { get; set; }
Property Value
| Type |
|---|
| OutlinesPanel |
SheetName
Gets the value indicating the name of the worksheet in the Workbook.
Declaration
public string SheetName { get; }
Property Value
| Type | Description |
|---|---|
| System.String | Name of the worksheet. |
Worksheet
Gets the value indicating the instance of IWorksheet in the Workbook.
Declaration
public IWorksheet Worksheet { get; }
Property Value
| Type | Description |
|---|---|
| IWorksheet | An instance of IWorksheet. |
Methods
add_QueryRange(SpreadsheetQueryRangeEventHandler)
Declaration
public void add_QueryRange(SpreadsheetQueryRangeEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetQueryRangeEventHandler | value |
Dispose(Boolean)
Releases all resources used by the. SpreadsheetGrid.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
Overrides
GetCalculatedValue(IRange)
Returns the calculated value (without formatting) for a formula cell.
Declaration
public string GetCalculatedValue(IRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | range | IRange. |
Returns
| Type |
|---|
| System.String |
Remarks
If the passed range is not a formula cell, then it returns null.
GetCellValue(Int32, Int32)
Used to get the value of the cell.
Declaration
public override object GetCellValue(int rowIndex, int colIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | RowIndex of the cell. |
| System.Int32 | colIndex | ColumnIndex of the cell. |
Returns
| Type | Description |
|---|---|
| System.Object | Returns the cell value. |
Overrides
GetDependentCellValue(Int32, Int32)
This method gets the dependent cell value of the corresponding row and column index of the SpreadsheetGrid.
Declaration
public override string GetDependentCellValue(int rowIndex, int colIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | Index of the corresponding cell's row. |
| System.Int32 | colIndex | Index of the corresponding cell's column. |
Returns
| Type | Description |
|---|---|
| System.String | An instance of IRange. |
Overrides
GetDisplayText(Int32, Int32)
Used to get the display text of the cell.
Declaration
public override string GetDisplayText(int rowIndex, int colIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | rowIndex | RowIndex of the cell. |
| System.Int32 | colIndex | ColumnIndex of the cell. |
Returns
| Type | Description |
|---|---|
| System.String | Returns the display text. |
Overrides
InitializeCellRendererCollection()
Initializes the CellRenderer Collection in the SpreadsheetGrid.
Declaration
protected override void InitializeCellRendererCollection()
Overrides
OnCellRequestNavigateEvent(CellRequestNavigateEventArgs)
Provides support for hyperlink navigation between different cells in SpreadsheetGrid.
Declaration
protected override bool OnCellRequestNavigateEvent(CellRequestNavigateEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRequestNavigateEventArgs | e | An instance of CellRequestNavigateEventArgs |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if the navigation can be done in cell; otherwise, false. |
Overrides
OnCreateCopyPaste()
Initialize the SpreadsheetCopyPaste when the SpreadsheetGrid is loaded.
Declaration
protected override GridCopyPaste OnCreateCopyPaste()
Returns
| Type | Description |
|---|---|
| GridCopyPaste | An instance of SpreadsheetCopyPaste. |
Overrides
OnCreateCurrentCell()
Creates a new instance of the GridCurrentCell which maintains the current cell in the grid.
Declaration
protected override GridCurrentCell OnCreateCurrentCell()
Returns
| Type | Description |
|---|---|
| GridCurrentCell | An instance of SpreadsheetColumn. |
Overrides
OnCreateGridColumn(SfCellGrid)
Creates a new instance of the GridColumn which holds the information of the every cells in the grid.
Declaration
protected override GridColumn OnCreateGridColumn(SfCellGrid grid)
Parameters
| Type | Name | Description |
|---|---|---|
| SfCellGrid | grid | An instance of SfCellGrid. |
Returns
| Type | Description |
|---|---|
| GridColumn | An instance of SpreadsheetColumn. |
Overrides
OnCreateVisualContainer()
To initialize the Visual Container
Declaration
protected override VisualContainer OnCreateVisualContainer()
Returns
| Type |
|---|
| VisualContainer |
Overrides
OnCurrentCellEndEdit(CurrentCellEndEditEventArgs)
Commits and ends the edit operation on the current cell in Spreadsheet.
Declaration
protected override void OnCurrentCellEndEdit(CurrentCellEndEditEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| CurrentCellEndEditEventArgs | e | An CurrentCellEndEditEventArgs that contains the event data. |
Overrides
OnDoubleClick(EventArgs)
Declaration
protected override void OnDoubleClick(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnHandleCreated(EventArgs)
Declaration
protected override void OnHandleCreated(EventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.EventArgs | e |
OnKeyDown(KeyEventArgs)
Occurs before the KeyDown event when a key is pressed while focus is on this control.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.KeyEventArgs | e | An System.Windows.Input.KeyEventArgs that contains the event data. |
Overrides
OnKeyUp(KeyEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.KeyUp attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs that contains the event data. |
OnLayout(LayoutEventArgs)
Need to fix the issue while programatically import the graphic cells and while navigating the different tabs.
Declaration
protected override void OnLayout(LayoutEventArgs levent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.LayoutEventArgs | levent |
Overrides
OnMouseDown(MouseEventArgs)
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.MouseEventArgs | e |
OnMouseMove(MouseEventArgs)
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.MouseEventArgs | e |
OnMouseUp(MouseEventArgs)
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.MouseEventArgs | e |
Overrides
OnMouseWheelZoom(MouseWheelZoomEventArgs)
Zoom the grid on mouse wheel.
Declaration
protected override void OnMouseWheelZoom(MouseWheelZoomEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.Windows.Forms.MouseWheelZoomEventArgs | e |
ProcessCmdKey(ref Message, Keys)
Used to Process key down operations
Declaration
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Message | msg | |
| System.Windows.Forms.Keys | keyData |
Returns
| Type |
|---|
| System.Boolean |
ProcessKeyEventArgs(ref Message)
Declaration
protected override bool ProcessKeyEventArgs(ref Message m)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Message | m |
Returns
| Type |
|---|
| System.Boolean |
remove_QueryRange(SpreadsheetQueryRangeEventHandler)
Declaration
public void remove_QueryRange(SpreadsheetQueryRangeEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| SpreadsheetQueryRangeEventHandler | value |
SetCellValue(IRange, String)
Sets the value or formula to the given IRange in the Workbook
Declaration
public void SetCellValue(IRange currentExcelRange, string cellValue)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | currentExcelRange | An instance of IRange |
| System.String | cellValue | Value to be displayed |
SetColumnWidth(Int32, Int32, Double)
Used to set the column width in the SpreadsheetGrid.
Declaration
public override void SetColumnWidth(int startIndex, int endIndex, double width)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | startIndex | Start column index. |
| System.Int32 | endIndex | End column index. |
| System.Double | width | Width of the column to expand. |
Overrides
SetRowHeight(Int32, Int32, Double)
Used to set the row height in the SpreadsheetGrid.
Declaration
public override void SetRowHeight(int startIndex, int endIndex, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | startIndex | Start row's index. |
| System.Int32 | endIndex | End row's index. |
| System.Double | height | Height of the row to resize. |
Overrides
ShowHidePopup(Boolean)
To show and hide popup's when moved to another application
Declaration
public override void ShowHidePopup(bool show)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | show | True, if the popup is displayed; otherwise false |
Overrides
UnWireEvents()
Unwires or unloads the events in SpreadsheetGrid.
Declaration
protected override void UnWireEvents()
Overrides
WireEvents()
Wires or loads the events in SpreadsheetGrid.
Declaration
protected override void WireEvents()
Overrides
WndProc(ref Message)
Declaration
protected override void WndProc(ref Message m)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Message | m |
Events
QueryRange
Occurs when grid queries for IRange information about a specifc cell while rendering.
Declaration
public event SpreadsheetQueryRangeEventHandler QueryRange
Event Type
| Type |
|---|
| SpreadsheetQueryRangeEventHandler |
Examples
var grid = spreadsheet.ActiveGrid;
grid.QueryRange+=grid_QueryRange;
void grid_QueryRange(object sender, SpreadsheetQueryRangeEventArgs e)
{
if (e.Cell.ColumnIndex == 5)
e.ExcelStyle.ColorIndex = ExcelKnownColors.Blue;
}