Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / SheetView Class / FrozenRows Property
Example


In This Topic
    FrozenRows Property
    In This Topic
    Gets or sets the number of frozen Rows in the Worksheet.  
    Syntax
    'Declaration
     
    
    Public Property FrozenRows As Integer
    'Usage
     
    
    Dim instance As SheetView
    Dim value As Integer
     
    instance.FrozenRows = value
     
    value = instance.FrozenRows
    public int FrozenRows {get; set;}
    Remarks

    Frozen Rows are always shown at the top of the SheetView when a user scrolls down.

    The default value is 0, which unfreezes all Rows. However, the value can be a number between 0 and 1048576. A value of 1048576 would freeze all Rows in the Worksheet; if a value of 3 was to be used, the first three Rows of the Worksheet would be frozen & would always be seen at the top of the SheetView, no matter how far the user scrolls down.

    Note that the freeze will always start with the first Row in the Worksheet.

    Example
    Freezes the first five rows and the first column:
    
    using( var workbook = Workbook.Load( "test.xlsx" ) )
    {
      // Freezes the first 5 rows and adds a Fill Background to them.
    
      worksheet.SheetView.FrozenRows = 5;
      worksheet.Rows[ 0, 4 ].Style.Fill.BackgroundColor = System.Drawing.Color.Turquoise;
    
      // Freezes the first column and adds a Fill Background to it.
      worksheet.SheetView.FrozenColumns = 1;
      worksheet.Columns[ 0 ].Style.Fill.BackgroundColor = System.Drawing.Color.Tan;
    
      // Saves the workbook to disk.
      workbook.SaveAs( "FreezeRowsColumns.xlsx" );
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also