API version 1

- ‐

swapRows

行範囲を他の行範囲と入れ替えます。

入れ替え先がスプレッドシートの範囲外となる部分がある場合(入れ替え先の範囲が maxRows プロパティの値を超える場合等)、例外が発生します。

入れ替え元と入れ替え先のセルを参照していた数式は入れ替えた先のセルを参照するよう自動的に変更されます。

呼出形式一覧

呼出形式

説明

void swapRows(integer srcRow1, integer srcRow2, integer dstRow)

srcRow1行からsrcRow2行までをdstRowを先頭行として入れ替えます。

戻り値一覧

戻り値

説明

void

なし

引数一覧

引数

説明

srcRow1

入れ替え元開始行番号。

srcRow2

入れ替え元終了行番号。

dstRow

入れ替え先開始行番号。

例外

識別子

説明

SYS-23:5

メソッドの引数が不正です

関連項目

swapColumnsswapRange メソッド



使用例 CRSダウンロード

Form Spread_swapRows {
   x = 0;
   y = 0;
   width = 800;
   height = 600;

   Spread spread1 {
           x = 8;
           y = 8;
           width = 640;
           height = 440;

           spread1 << CSV {
                   1,
                   2,=A1*2
                   3,=A2*2
                   4,=A3*2
                   5,=A4*2
           };

           maxColumns = 20;
           maxRows = 20;

           var s = new SpreadStyle;
           s.bgColor = "#EEFFEE";
           rows(2,3).style = s;

           s.bgColor = "#EEFFFF";
           rows(4,5).style = s;
   }

   Button button1 {
           x = 664;
           y = 32;
           width = 112;
           height = 32;
           title = "実行";
           function onTouch(e) {
                   #行番号2~3を行番号4(~5)と入れ替えます
                   ^.spread1.swapRows(2,3,4);
           }
   }
}