GrapeCity SPREAD for Windows Forms 11.0J サンプルコード集
ペーストするデータの種類を変更する

セルのコピー&ペースト(またはカット&ペースト)を行った場合、デフォルトでは値/書式/数式を含む全てのデータオブジェクトが貼り付けられますが、入力マップ定義の変更により、例えば値のみペーストを可能とするような対応も可能となります。(デフォルトはClipboardPasteAll:全ての内容)

  • クリップボード機能は製品独自のものではなく、基本的に.NET Frameworkより提供されているClipBoardクラスの各機能を用いて実現されています。当クラスの詳細についてはMSDNライブラリをご参照ください。

 private void Form1_Load(object sender, System.EventArgs e)
 {

   //[Ctrl+V]の動作を「値のみのペースト」に変更します
   FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);

   im.Put(new FarPoint.Win.Spread.Keystroke(Keys.V, Keys.Control), FarPoint.Win.Spread.SpreadActions.ClipboardPasteValues);

 }
 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

   '[Ctrl+V]の動作を「値のみのペースト」に変更します
   Dim im As New FarPoint.Win.Spread.InputMap
   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

 

 


© 2004-2018, GrapeCity inc. All rights reserved.