Sets the name of the direct style for the specified cell, column, row, or model default to the specified style name.
Syntax
Parameters
- row
- Model row index of the cell, or -1 to specify a column or model default
- column
- Model column index of the cell, or -1 to specify a row or model default
- styleName
- Name of the style to set
Exceptions
Remarks
Example
This example creates a new NamedStyle object. The background color of the NamedStyle is set to yellow and the Name is set to "Yellow Cell". The value from the GetDirectName method is returned to a list box.
C# | Copy Code |
---|
private void Page_Load(object sender,System.EventArgs e)
{
if(this.IsPostBack)return;
FarPoint.Web.Spread.Model.DefaultSheetStyleModel model=(FarPoint.Web.Spread.Model.DefaultSheetStyleModel)FpSpread1.Sheets[0].StyleModel;
FarPoint.Web.Spread.NamedStyle style=new FarPoint.Web.Spread.NamedStyle();
style.Name="YellowCell";
style.BackColor=Color.Yellow;
FpSpread1.NamedStyles.Add(style);
model.SetDirectName(0,0,"YellowCell");
ListBox1.Items.Add(model.GetDirectName(0,0));
} |
Visual Basic | Copy Code |
---|
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
If(IsPostBack)Then Return
Dim model As FarPoint.Web.Spread.Model.DefaultSheetStyleModel=FpSpread1.Sheets(0).StyleModel
Dim style As New FarPoint.Web.Spread.NamedStyle()
style.Name="YellowCell"
style.BackColor=Color.Yellow
FpSpread1.NamedStyles.Add(style)
model.SetDirectName(0,0,"YellowCell")
ListBox1.Items.Add(model.GetDirectName(0,0))
End Sub |
Requirements
Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6
See Also