Spread ASP.NET 6.0 Product Documentation
GetDirectName Method
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetStyleModel Class : GetDirectName Method


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

Glossary Item Box

Gets the name of the direct style assigned to a cell, column, row, or model default.

Syntax

Visual Basic (Declaration) 
Public Overridable Function GetDirectName( _
   ByVal row As Integer, _
   ByVal column As Integer _
) As String
Visual Basic (Usage)Copy Code
Dim instance As DefaultSheetStyleModel
Dim row As Integer
Dim column As Integer
Dim value As String
 
value = instance.GetDirectName(row, column)
C# 
public virtual string GetDirectName( 
   int row,
   int column
)

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

Return Value

String containing the name of the style for the specified cell, column, row, or model, or an empty string if the specified cell, column, row, or model has no named style assigned.

Exceptions

ExceptionDescription
System.IndexOutOfRangeException Specified row index is not valid; must be between -1 and the total number of rows
System.IndexOutOfRangeException Specified column index is not valid; must be between -1 and the total number of columns

Remarks

Direct cell styles override direct row styles, which override direct column styles, which override model default styles. Direct row styles use -1 for the column, direct column styles use -1 for the row, and model default styles use -1 for both the row and column.

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
privatevoidPage_Load(objectsender,System.EventArgse)
{
if(this.IsPostBack)return;

FarPoint.Web.Spread.Model.DefaultSheetStyleModelmodel=(FarPoint.Web.Spread.Model.DefaultSheetStyleModel)FpSpread1.Sheets[0].StyleModel;
FarPoint.Web.Spread.NamedStylestyle=newFarPoint.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 BasicCopy Code
PrivateSubPage_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
If(IsPostBack)ThenReturn

DimmodelAsFarPoint.Web.Spread.Model.DefaultSheetStyleModel=FpSpread1.Sheets(0).StyleModel
DimstyleAsNewFarPoint.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))
EndSub

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2002-2012 GrapeCity, Inc. All Rights Reserved.