【Tips】セルの値のみのカット&ペーストを実装する方法

文書番号 : 33488     文書種別 : 使用方法     登録日 : 2012/11/14     最終更新日 : 2012/11/14
文書を印刷する
対象製品
SPREAD for Windows Forms 7.0J
詳細
セルのカット&ペーストを行った場合、デフォルトの入力マップでは、値・書式・数式を含むすべてのデータオブジェクトが対象となります。セルの値以外を元のセルに残し、値のみペーストを行う場合は、カット[Ctrl]+[X]およびペースト[Ctrl]+[V]のそれぞれの入力マップを変更します。

◎サンプルコード(VB)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim im As New FarPoint.Win.Spread.InputMap

    ' カット[Ctrl]+[X]の入力マップを変更します
    im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.X, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardCutDataOnly)

    ' ペースト[Ctrl]+[V]の入力マップを変更します
    im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
    im.Put(New FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardPasteValues)

End Sub

◎サンプルコード(C#)
private void Form1_Load(object sender, EventArgs e)
{
    FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();

    // カット[Ctrl]+[X]の入力マップを変更します
    im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
    im.Put(new FarPoint.Win.Spread.Keystroke(Keys.X, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardCutDataOnly);

    // ペースト[Ctrl]+[V]の入力マップを変更します
    im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
    im.Put(new FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardPasteValues);
}

関連情報
キーワード
「クリップボード」