This project is read-only.

Clipboard Operations

Built-in Clipboard Support

  • Copy tabbed plain-text from/into Clipboard
  • Copy from another instance of ReoGrid with styles and borders

Tabbed plain-text

A format of tabbed plain-text usually copied from Excel or similar application:
A1 \t B1 \t C1 \n
A2 \t B2 \t C2 \n
A3 \t B3 \t C3 \n


Get text like this from Clipboard:
string text = Clipboard.GetText();
ReoGrid provides a method to help parsing this format into object array:
object[,] data = RGUtility.ParseTabbedString(text);
Then set object array to grid:
grid.SetRangeData(grid.SelectionRange, data);

Prevent Built-in Clipboard Operations

Control processes the Clipboard operations when Ctrl-C, Ctrl-V and Ctrl-X received from user. By handling Clipboard events can prevent the built-in operations:
  • BeforeCopy
  • AfterCopy
  • BeforePaste
  • AfterPaste
  • BeforeCut
  • AfterCut
All 'BeforeEvent' have property name IsCancelled which is used to notify control to cancel current operation.
grid.BeforePaste += (s,e) => { e.IsCancelled = true; };

Methods about Clipboard

Methods to check whether the operations can be performed now:
Method Desc
bool CanCopy() check whether can do copy operation now
bool CanPaste() check whether can do paste operation (that is, identifiable data existed in Clipboard)
bool CanCut() same as CanCopy

Methods to raise Clipboard processing by programming:
bool Copy();
bool Paste();
bool Cut();

Next: Cell Edit

Last edited Feb 5, 2014 at 3:08 PM by unvell, version 7