Xceed Workbooks for .NET v1.4 Documentation
FrozenColumns Property
Example 


Xceed.Workbooks.NET Assembly > Xceed.Workbooks.NET Namespace > SheetView Class : FrozenColumns Property
Gets or sets the number of frozen Columns in the Worksheet. Frozen Columns are always shown at the left of the SheetView when a user scrolls to the right.
Syntax
'Declaration

 

Public Property FrozenColumns As Integer
'Usage

 

Dim instance As SheetView

Dim value As Integer

 

instance.FrozenColumns = value

 

value = instance.FrozenColumns
public int FrozenColumns {get; set;}
Remarks

The freeze always starts with the first Column in the Worksheet.

The default value is 0, which unfreezes all Columns. However, the value can be a number between 0 and 16384. A value of 16384 would freeze all Columns in the Worksheet. If a value of 3 is used, the first three Columns of the Worksheet will be frozen and will always be seen at the left of the SheetView, no matter how far the user scrolls to the right.

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

Reference

SheetView Class
SheetView Members