MESCIUS SPREAD for ASP.NET 10.0J
GetDirectAltRowName メソッド (DefaultSheetStyleModel)

設定する交互行スタイルのインデックス
交互行スタイルのスタイル名を取得します。
構文
'Declaration
 
Public Overridable Function GetDirectAltRowName( _
   ByVal index As Integer _
) As String
public virtual string GetDirectAltRowName( 
   int index
)

パラメータ

index
設定する交互行スタイルのインデックス

戻り値の型

指定した交互行のスタイル名を含むString。指定した交互行インデックスに名前付きスタイルが割り当てられていない場合は空の文字列。
例外
例外説明
System.IndexOutOfRangeException指定したインデックスは有効でありません。有効範囲は0〜スタイル合計数です。
解説
indexの有効範囲は、0〜AltRowCountプロパティの値-1となります。
この例では、新しいNamedStyleオブジェクトを作成します。NamedStyleの名前と背景色のプロパティを設定し、このメソッドを使用してNamedStyleを取得します。
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.NamedStylestyle = new FarPoint.Web.Spread.NamedStyle();
	style.Name = "YellowCell";
	style.BackColor = Color.Yellow;

	model.SetDirectAltRowInfo(0, style);
	ListBox1.Items.Add("StyleName:" + model.GetDirectAltRowName(0));

	FarPoint.Web.Spread.StyleInfostyle1 = model.GetDirectAltRowInfo(0, null);
	ListBox1.Items.Add("BackColor:" + style1.BackColor.ToString());
}
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

	model.SetDirectAltRowInfo(0, style)
	ListBox1.Items.Add("StyleName:" & model.GetDirectAltRowName(0))

	Dim style1 As FarPoint.Web.Spread.StyleInfo = model.GetDirectAltRowInfo(0, Nothing)
	ListBox1.Items.Add("BackColor:" & style1.BackColor.ToString())
End Sub
参照

DefaultSheetStyleModel クラス
DefaultSheetStyleModel メンバ
GetDirectAltRowInfo メソッド
SetDirectAltRowInfo メソッド
GetDirectName メソッド
SetDirectAltRowName メソッド
AltRowCount プロパティ
NamedStyles プロパティ

 

 


© MESCIUS inc. All rights reserved.