Spread Windows Forms 15.0
Spread Windows Forms 15.0 Product Documentation / Developer's Guide / Spreadsheet Objects / Resetting Parts of the Interface
In This Topic
    Resetting Parts of the Interface
    In This Topic

    You can reset various settings on various parts of the Spread component interface back to default or original values. You can also clear parts of the data area of various items, both data and formatting.

    The ways in which parts of the component can be reset include:

    Reset the settings for cells, rows, or columns using the individual reset methods for each setting in the Cell or Row or Column class:

    Resetting Desired Method Name
    Background color for individual cells or for row or column of cells ResetBackColor
    Border for individual cells or for row or column of cells ResetBorder
    Cell type for individual cells or for row or column of cells ResetCellType
    Text font for individual cells or for row or column of cells ResetFont
    Foreground color for individual cells or for row or column of cells ResetForeColor
    Row height ResetHeight
    Cell contents horizontal alignment for individual cells or for row or column of cells ResetHorizontalAlignment
    Cell header label ResetLabel
    Locked status for individual cells or for row or column of cells ResetLocked
    Merge policy for a row or column of cells ResetMergePolicy
    Cell note indicator color for individual cells or for row or column of cells ResetNoteIndicatorColor
    Parent style name for individual cells or for row or column of cells ResetParentStyleName
    Column resizable ResetResizable
    Column sort indicator ResetSortIndicator
    Cell contents vertical alignment for individual cells or for row or column of cells ResetVerticalAlignment
    Row or column visible ResetVisible
    Column width ResetWidth

    Reset all the named style properties to their default values using the NamedStyle class Reset method. There are also individual reset methods for each of the settings in a style:

    Method Name Resetting Desired
    Reset All the properties of the style
    ResetBackColor Background color of a cell
    ResetBorder Border around a cell
    ResetCanFocus Whether the cell can receive focus
    ResetCellType Cell type of the cell
    ResetEditor Editor used for editing the cell
    ResetFont Font face used in the text of the cell
    ResetForeColor Text (foreground) color in a cell
    ResetFormatter Formatter for formatting the contents of the cell
    ResetHorizontalAlignment horizontal alignment of text in a cell
    ResetLocked Whether the cell is marked as locked
    ResetName Default name of the style
    ResetNoteIndicatorColor Color of the cell note indicator
    ResetNoteStyle Cell note style
    ResetParent (Inherited from StyleInfo) Parent style name
    ResetProperty Specified setting property
    ResetRenderer Renderer for painting the cell
    ResetTabStop Whether the user can set focus to the cell using the Tab key
    ResetVerticalAlignment Vertical alignment of text in a cell

    If you are setting the background color for an individual cell, then ResetBackColor resets that cell's background color to its default color. If, instead, you set the background color using the BackColor property for a Row object, then you must use the ResetBackColor for that row. If you want to loop all the cells setting the color to White, you can speed this up by invalidating the painting in the Spread while you are looping the cells as shown in the following code.

    Visual Basic
    Copy Code
    fpSpread1.SuspendLayout()
    fpSpread1.Sheets(0).Cells(0, 0, 499, 499).BackColor = Color.White
    fpSpread1.ResumeLayout(True)
    
    C#
    Copy Code
    fpSpread1.SuspendLayout();
    fpSpread1.Sheets[0].Cells(0, 0, 499, 499).BackColor = Color.White;
    fpSpread1.ResumeLayout(true);
    

    Resetting the component or a sheet to its default settings returns the component or the sheet to its initial state prior to any design-time or run-time changes. It clears data, resets colors, and returns cells to the default cell type. Resetting the component resets everything in the component to the state when the component is first drawn on the form.

    Note: Resetting the component or a sheet clears the data in the sheet(s) as well as the formatting. If you provide a way for users to reset their sheet(s), be sure to have them confirm the action before resetting the sheet(s).

    You can find out the default size of the component using the FpSpread DefaultSize property.

    For more information about clearing data, refer to Removing Data from a Sheet.

    For information on resetting values creating during the design using Spread Designer, refer to the explanation of this procedure in the Spread Designer Guide.

    See Also