Spread Windows Forms 16
Spread Windows Forms 16.0 Product Documentation / Developer's Guide / Rows and Columns / Setting Fixed (Frozen) Rows or Columns
In This Topic
    Setting Fixed (Frozen) Rows or Columns
    In This Topic

    You can freeze rows or columns or both in a sheet to make them unscrollable.

    Note: Frozen rows or columns are not scrollable at run time but they are scrollable during design time.

    Set Frozen Rows or Columns

    The frozen top rows are called leading rows and the frozen left-most columns are called leading columns. The frozen leading rows and columns stay at the top and left of the view regardless of the scrolling.

    You can set the number of frozen rows or columns by using the FrozenRowCount or FrozenColumnCount properties.

     

    C#
    Copy Code
    // freeze rows and columns
    FpSpread1.Sheets[0].FrozenColumnCount = 2;
    FpSpread1.Sheets[0].FrozenRowCount = 2;
    
    Visual Basic
    Copy Code
    'freeze rows And columns
    FpSpread1.Sheets(0).FrozenColumnCount = 2
    FpSpread1.Sheets(0).FrozenRowCount = 2
    

    Set Trailing Frozen Rows or Columns

    The frozen trailing rows and columns stay at the bottom and right of the view regardless of the scrolling.

    You can set the number of frozen trailing bottom rows or trailing right-most columns by using FrozenTrailingColumnCount or FrozenTrailingRowCount properties.

    When the height of data rows and frozen trailing rows is less than that of the viewport area, you can choose whether to display the blank space between the data rows and frozen trailing rows or not. The FrozenTrailingStickToEdge option can be used to control this behavior and accepts RowCol enumeration values such as Both (default), Rows, Columns, None.

    When FrozenTrailingStickToEdge = Row When FrozenTrailingStickToEdge = None
    Frozen Trailing Rows with stickToEdge Parameter set To True Frozen Trailing Rows with stickToEdge Parameter set To False

    C#
    Copy Code
    fpSpread1.ActiveSheet.Rows.Count = 25;
    fpSpread1.ActiveSheet.Columns.Count = 20;
    fpSpread1.Sheets[0].FrozenTrailingRowCount = 5;
    fpSpread1.ActiveSheet.FrozenTrailingStickToEdge = FarPoint.Win.Spread.RowCol.Rows;
    
    Visual Basic
    Copy Code
    FpSpread1.ActiveSheet.Rows.Count = 25
    FpSpread1.ActiveSheet.Columns.Count = 20
    FpSpread1.Sheets(0).FrozenTrailingRowCount = 5
    FpSpread1.ActiveSheet.FrozenTrailingStickToEdge = FarPoint.Win.Spread.RowCol.Rows
    

    When using the print option, trailing frozen rows and columns are not printed repeatedly at the bottom and right of every page, but print only once as the last row and column.

    Leading frozen rows and columns can be repeatedly printed at the top and left of every page. For more information about repeating rows and columns, refer to Repeating Rows or Columns on Printed Pages.

    Set Frozen Line Color

    You can specify the color of the line displayed between the frozen and non-frozen areas of the worksheet with the FrozenLineColor property in the WorksheetOptions class. By default, no color is set to show the frozen line.

    The preferred frozen line color can be chosen by using Color methods.

    C#
    Copy Code
    // freeze rows and columns
    fpSpread1.Sheets[0].FrozenColumnCount = 2;
    fpSpread1.Sheets[0].FrozenRowCount = 2;
    fpSpread1.Sheets[0].FrozenTrailingColumnCount = 2;
    fpSpread1.Sheets[0].FrozenTrailingRowCount = 2;
    // set frozen line color
    fpSpread1.AsWorkbook().Worksheets[0].Options.FrozenLineColor = GrapeCity.Spreadsheet.Color.FromArgb(0, 0, 255);
    
    Visual Basic
    Copy Code
    'freeze rows And columns
    FpSpread1.Sheets(0).FrozenColumnCount = 2
    FpSpread1.Sheets(0).FrozenRowCount = 2
    FpSpread1.Sheets(0).FrozenTrailingColumnCount = 2
    FpSpread1.Sheets(0).FrozenTrailingRowCount = 2
    'set frozen line color
    FpSpread1.AsWorkbook().Worksheets(0).Options.FrozenLineColor = GrapeCity.Spreadsheet.Color.FromArgb(0, 0, 255)
    

    Set Frozen Line Width

    You can specify or change the width of the displayed line between the frozen and non-frozen areas of the worksheet using FrozenLineThickness property from the WorksheetOptions class.

    C#
    Copy Code
    fpSpread1.ActiveSheet.FrozenColumnCount = 3;
    fpSpread1.ActiveSheet.AsWorksheet().Options.FrozenLineThickness = 5;
    
    VB
    Copy Code
    fpSpread1.ActiveSheet.FrozenColumnCount = 3
    fpSpread1.ActiveSheet.AsWorksheet().Options.FrozenLineThickness = 5
    

    Using the Properties Window

    1. At design time, in the Properties window, select the Sheet.
    2. In the SheetView Collection Editor (Appearance section), set the FrozenRowCount, FrozenColumnCount, FrozenTrailingRowCountFrozenTrailingColumnCount, or the FrozenTrailingStickToEdge property.

    Using the Spread Designer

    1. Select Sheet from the drop-down combo list located on the top right side of the Designer.
    2. From the SheetView Collection Editor,set the FrozenColumnCount, FrozenRowCount, FrozenTrailingColumnCountFrozenTrailingRowCount, FrozenTrailingStickToEdge.
    3. From the File menu, select Save and Exit to save the changes.
    See Also