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).
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.
Using a Shortcut
- Set the Cell shortcut object Margin property to the new margins.
- 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
- Select the Settings menu.
- Select the cells to apply the changes to.
- 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.
- 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.
- Click Apply and Exit to close the Spread Designer.