Saturday, October 11, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Appearance » Sheet

Previous Customizing the Sheet Appearance Next

You can have multiple sheets within a workbook. Each sheet is a separate spreadsheet and can have its own appearance and settings for user interaction. Each sheet has a unique name and sheet name tab for easy navigation between sheets.

  Back to Top
 Working with the Active Sheet
The active sheet is the sheet that currently receives any user interaction. You can specify the active sheet programmatically by using the ActiveSheet property of the FpSpread object. You can also specify the index of the active sheet by using the ActiveSheetIndex property.

// Set third sheet (in zero-based index) be set to active sheet
fpSpread1.ActiveSheetIndex = 2;

' Set third sheet (in zero-based index) be set to active sheet
FpSpread1.ActiveSheetIndex = 2


  Back to Top
  Working with Multiple Sheets
The control allows multiple sheets. You can specify the number of sheets with the Count property of the SheetView class. You can specify properties for an individual sheet or for several sheets at a time. You can name the sheets or use the default sheet names. The default sheet name is "Sheet1" and as other sheets are added, the sheet are named incrementally "Sheet2", "Sheet3", etc. Use the SheetName property in the SheetView class to name the sheet programmatically.

  Back to Top
 Tab Strip Location
The FpSpread component is made up of the spreadsheet that displays the data along with scroll bars and, if multiple sheets, sheet tabs in a tab strip. The tab strip can be customized and placed on the bottom of the control, default, or on top. There are several properties that allow customization of the tab stip, including the color, font and size.

  Back to Top
  Adding a Sheet
You can add a sheet or add several sheets to the control. By default, the control has one sheet, named Sheet 1 and referenced as sheet index 0. The sheet index is zero-based. In code, you can simply change the sheet count or you can explicitly add the sheet(s). If you are using custom sheet names be sure to specify the name of the sheet.

// Add the new sheet to the control
FarPoint.Win.Spread.SheetView newSheet = new FarPoint.Win.Spread.SheetView();
fpSpread1.Sheets.Add(newsheet);

' Add the new sheet to the control
Dim newSheet as new FarPoint.Win.Spread.SheetView()
FpSpread1.Sheets.Add(newsheet)


  Back to Top
  Removing a Sheet
You can remove a sheet or remove several sheets from the control. The sheet index is zerobased. In code, you can simply change the sheet count or you can explicitly remove the sheet(s).

// Remove the second sheet
fpSpread1.Sheets.Remove(fpSpread1.Sheets[1]);

' Remove the second sheet
FpSpread1.Sheets.Remove(FpSpread1.Sheets(1))


  Back to Top
  Hiding a Sheet
You can hide a sheet so that it is not displayed to the user without removing it from the control. Hiding a sheet does not remove it and does not affect formulas on that sheet or references to that sheet.

// Set the first sheet to not be displayed
fpSpread1.Sheets[0].Visible = false;

' Set the first sheet to not be displayed
FpSpread1.Sheets(0).Visible = False


  Back to Top
  Setting the Background Color for the Sheet
The background color for the sheet is displayed in the area where cells are not displayed. By default, the area is the system's Control color. You can change this to any color.

// Set the first sheet's background color to light yellow
fpSpread1.Sheets[0].GrayAreaBackColor = Color.LightYellow;

' Set the first sheet's background color to light yellow
FpSpread1.Sheets(0).GrayAreaBackColor = Color.LightYellow


  Back to Top
  Displaying Grid Lines on the Sheet
Sheets can display grid lines. You can set the color, the width, and the style of grid lines. You can choose to display the grid lines as three-dimensional lines, with a highlight and shadow color. If you do so, set the highlight and shadow color to create the effect you want.

FarPoint.Win.Spread.GridLine HGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.Flat, Color.Red);
fpSpread1.Sheets[0].HorizontalGridLine = HGridLine;

Dim HGridLine As New FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.Flat, Color.Chartreuse)
FpSpread1.Sheets(0).HorizontalGridLine = HGridLine


  Back to Top
  Customizing the Sheet Corner
You can customize the appearance of the sheet corner, the header cell in the upper left corner of the sheet, for each sheet. You can set the style of the sheet corner as you would any cell in the spreadsheet. Sheet corners can display grid lines, have a different background color from the rest of the headers, and more.

// Sets the background color to light blue
fpSpread1.ActiveSheet.SheetCornerStyle.BackColor = Color.LightBlue;

' Sets the background color to light blue
FpSpread1.ActiveSheet.SheetCornerStyle.BackColor = Color.LightBlue


  Back to Top
  Applying a Skin to a Sheet
You can quickly customize the appearance of a sheet by applying a "skin" to it. Spread includes several built-in skins that are already made and ready for you to use. You can also create your own custom skin and save it so that you can use it in other Spread controls for a common format.

// Sets the first sheet to use the Colorful2 predefined skin.
FarPoint.Win.Spread.DefaultSkins.Colorful2.Apply(fpSpread1.Sheets[0]);

' Sets the first sheet to use the Colorful2 predefined skin.
FarPoint.Win.Spread.DefaultSkins.Colorful2.Apply(FpSpread1.Sheets(0))

Play Video play video

  Back to Top
  Creating a Custom Skin for a Sheet
You can quickly customize the appearance of a sheet by applying a "skin" to it. Some built-in skins are provided with Spread to create common formats. You can create your own custom skin and save it to use again, similar to a template. A skin, whether built-in or custom, can be applied to any number of sheets. Just as a style can be applied to cells, so a skin can be applied to an entire sheet.
Play Video play video


Previous Customizing the Sheet Appearance Next

    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
Learn about the new Roadshow now!

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.