【Tips】シート左上および右下のセルの行(列)インデックスを取得する

文書番号 : 33470     文書種別 : 使用方法     登録日 : 2012/11/14     最終更新日 : 2012/11/14
文書を印刷する
対象製品
SPREAD for Windows Forms 7.0J
詳細
現在表示されているシート左上のセルの行(列)インデックスを取得するにはFpSpreadクラスのGetViewportTopRowメソッド(GetViewportLeftColumnメソッド)を使用します。また、現在表示されているシート右下のセルの行(列)インデックスを取得するにはFpSpreadクラスのGetViewportBottomRowメソッド(GetViewportRightColumnメソッド)を使用します。

◎サンプルコード(VB)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  Dim TopRow As Integer
  Dim LeftCol As Integer
  Dim BottomRow As Integer
  Dim RightColumn As Integer
  TopRow = FpSpread1.GetViewportTopRow(0)
  LeftCol = FpSpread1.GetViewportLeftColumn(0)
  BottomRow = FpSpread1.GetViewportBottomRow(0)
  RightColumn = FpSpread1.GetViewportRightColumn(0)
  Console.WriteLine("TopRow:" + TopRow.ToString() + ",LeftColumn:" + LeftCol.ToString())
  Console.WriteLine("BottomRow:" + BottomRow.ToString() + ",RightColumn:" + RightColumn.ToString())
End Sub

◎サンプルコード(C#)
private void button1_Click(object sender, EventArgs e)
{
  int TopRow;
  int LeftCol;
  int BottomRow;
  int RightColumn;
  TopRow = fpSpread1.GetViewportTopRow(0);
  LeftCol = fpSpread1.GetViewportLeftColumn(0);
  BottomRow = fpSpread1.GetViewportBottomRow(0);
  RightColumn = fpSpread1.GetViewportRightColumn(0);
  Console.WriteLine("TopRow:" + TopRow.ToString() + ",LeftColumn:" + LeftCol.ToString());
  Console.WriteLine("BottomRow:" + BottomRow.ToString() + ",RightColumn:" + RightColumn.ToString());
}
関連情報
キーワード
「セル位置の設定/取得」