Spread ASP.NET 6.0 Product Documentation
Customizing the Margins and Spacing of the Cell
Send Feedback
Spread ASP.NET 6.0 Product Documentation > Developer's Guide > Customizing the Appearance > Customizing the Appearance of a Cell > Customizing the Margins and Spacing of the Cell

Glossary Item Box

You can customize the margins within a cell and the spacing between cells in a sheet. The cell margin is the distance between the cell border and the cell contents and is specified for all four sides of a cell (or table cell in the displayed HTML). The cell spacing is the distance between the cells and is specified for the entire sheet (or table in the displayed HTML).

Cell Spacing Terminology

To set the cell margin (or padding) use the Margin property in the Cell (or Column or Row) class, or set the Margin property in the StyleInfo class and apply the style to the cell or cells.

To set the cell spacing for the entire sheet, use the CellSpacing property in the Sheet or set the CellSpacing property in the SheetSkin class and apply the skin to the sheet or sheets.

To set the border, use the Border property as described in Customizing Cell Borders.

Return to the cell appearance overview at Customizing the Appearance of a Cell.

Using a Shortcut

  1. Set the Cell shortcut object Margin property to the new margins.
  2. Set the Sheet CellSpacing property to the new cell spacing value.

Example

This example code creates a cell margin and sets cell spacing for the sheet.

C# Copy Code
FarPoint.Web.Spread.Cell mycell; 
FarPoint.Web.Spread.Inset margin = new FarPoint.Web.Spread.Inset(20, 40, 50, 20); 
mycell = FpSpread1.Cells[0, 0]; 
mycell.Value = "Margin"; 
mycell.Locked = true; 
mycell.Margin = margin; 
FpSpread1.ActiveSheetView.Rows[0].Height = 80;
FpSpread1.Sheets[0].CellSpacing = 5;
VB Copy Code
Dim mycell As FarPoint.Web.Spread.Cell
Dim margin As New FarPoint.Web.Spread.Inset(20, 40, 50, 20)
mycell = FpSpread1.Cells(0, 0)
mycell.Value = "Margin"
mycell.Locked = True
mycell.Margin = margin
FpSpread1.ActiveSheetView.Rows(0).Height = 80
FpSpread1.Sheets(0).CellSpacing = 5

Using the Spread Designer

  1. Select the Settings menu.
  2. Select the cells to apply the changes to.
  3. Use the following to set the margin:

    Select the Cells, Columns, and Rows icon under the Other Settings section.

    Click on the Margin property in the property grid to create an inset for the cell in pixel units.

    Click OK to apply the changes.

  4. To apply the cell spacing, do the following:

    Select the Settings menu.

    Select the SheetSkin icon in the Appearance Settings section.

    Select the custom tab in the SheetSkin editor.

    Set CellSpacing in the Misc. section.

    Click OK to apply the changes.

  5. Click Apply and Exit to close the Spread Designer.
© 2002-2012 GrapeCity, Inc. All Rights Reserved.