EditPoint.Paste Method
Visual Studio 2012
Inserts the clipboard contents at the current location.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
public void PasteExample(DTE2 dte) { // Create a new text file and insert ten lines of text. dte.ItemOperations.NewFile(@"General\Text File", "", Constants.vsViewKindPrimary); TextDocument textDoc = (TextDocument)dte.ActiveDocument.Object("TextDocument"); EditPoint editPnt = textDoc.StartPoint.CreateEditPoint(); for (int i = 1; i <= 10; i++) editPnt.Insert("Line " + i.ToString() + "\n"); if (MessageBox.Show("Reverse the order of the lines?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { TextSelection textSel = textDoc.Selection; // Position the insertion point at beginning of "Line 2". textSel.StartOfDocument(false); textSel.LineDown(false, 1); // Reverse the order of the lines by cutting "Line 2" and // pasting it at the start of the document, then cutting // "Line 3" and pasting it at the start of the document, // and so on. for (int i = 1; i <= 9; i++) { textSel.LineDown(true, 1); textSel.Cut(); editPnt.StartOfDocument(); editPnt.Paste(); } } }
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.