TextSelection.Insert(String, Int32) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在当前插入点插入给定字符串。
void Insert(std::wstring const & Text, int vsInsertFlagsCollapseToEndValue = 1);
[System.Runtime.InteropServices.DispId(35)]
public void Insert (string Text, int vsInsertFlagsCollapseToEndValue = 1);
[<System.Runtime.InteropServices.DispId(35)>]
abstract member Insert : string * int -> unit
Public Sub Insert (Text As String, Optional vsInsertFlagsCollapseToEndValue As Integer = 1)
参数
- Text
- String
要插入的文本。
- vsInsertFlagsCollapseToEndValue
- Int32
vsInsertFlags值之一,指示如何插入文本。
- 属性
示例
[Visual Basic]
Sub InsertExample()
' Before running this example, open a text document.
Dim objSel As TextSelection = DTE.ActiveDocument.Selection
' Go to the first line in document and select it.
objSel.GotoLine(1, True)
' Insert some new lines and some text.
objSel.NewLine(3)
objSel.Insert("A new line", vsInsertFlags.vsInsertFlagsInsertAtStart)
End Sub