Spread Windows Forms 6.0 Product Documentation
SetDirectName Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.Model Namespace > INamedStyleSupport Interface : SetDirectName Method


row
Row index of the cell in the model, or -1 to specify a column or model default
column
Column index of the cell in the model, or -1 to specify a row or model default
styleName
Name of the style to set

Glossary Item Box

Sets the direct style for the specified cell, column, row, or model default to the specified style name.

Syntax

Visual Basic (Declaration) 
Sub SetDirectName( _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal styleName As String _
) 
Visual Basic (Usage)Copy Code
Dim instance As INamedStyleSupport
Dim row As Integer
Dim column As Integer
Dim styleName As String
 
instance.SetDirectName(row, column, styleName)
C# 
void SetDirectName( 
   int row,
   int column,
   string styleName
)

Parameters

row
Row index of the cell in the model, or -1 to specify a column or model default
column
Column index of the cell in the model, or -1 to specify a row or model default
styleName
Name of the style to set

Remarks

This method sets the name of the style for the specified cell, column, row, or model default. If the specified style name does not exist in the named styles collection, then a new NamedStyle is created with the specified name and added to the named styles collection (NamedStylesCollection).

In terms of precedence of styles, direct cell styles override direct row styles, which override direct column styles, which override model default styles.

In terms of allowed values, for a direct row style, use -1  for the entire column; for a direct column style, use -1 for the entire row; and for a model default style, use -1 for both rows and columns.

Example

This example returns the name of the named style used to change the background color of a cell.
C#Copy Code
FarPoint.Win.Spread.Model.INamedStyleSupport ins;
FarPoint.Win.Spread.NamedStyle ns = new FarPoint.Win.Spread.NamedStyle("StyleData");
ns.BackColor = Color.LightBlue;
fpSpread1.NamedStyles.Add(ns);
ins = (FarPoint.Win.Spread.Model.INamedStyleSupport)fpSpread1.ActiveSheet.Models.Style;
ins.SetDirectName(1, 1, "StyleData");
label1.Text = "The name of the style used to change the color in the cell is " + ins.GetDirectName(1, 1).ToString();
Visual BasicCopy Code
Dim ins As FarPoint.Win.Spread.Model.INamedStyleSupport
Dim ns As New FarPoint.Win.Spread.NamedStyle("StyleData")
ns.BackColor = Color.LightBlue
FpSpread1.NamedStyles.Add(ns)
ins = FpSpread1.ActiveSheet.Models.Style
ins.SetDirectName(1, 1, "StyleData")
Label1.Text = "The name of the style used to change the color in the cell is " & ins.GetDirectName(1, 1).ToString()

Requirements

Target Platforms: 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

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.