WPS 加载项开发 > 文字 API 参考 > FormField > 方法 > FormField.Cut 方法
将指定窗体域从文档中移到剪贴板上。

语法

表达式.Cut

表达式   必选。一个代表 FormField 对象的变量。

示例

本示例删除活动文档的第一个域,并将该域粘贴到插入点。

示例代码
if(ActiveDocument.Fields.Count >= 1) {
    ActiveDocument.Fields.Item(1).Cut()
    Selection.Collapse(wdCollapseEnd)
    Selection.Paste()
}

本示例删除第一段的第一个单词,并将该单词粘贴到该段的末尾。

示例代码
let ran= ActiveDocument.Paragraphs.Item(1).Range
ran.Words.Item(1).Cut()
ran.Collapse(wdCollapseEnd)
ran.Move(wdCharacter,-1)
ran.Paste()

本示例删除所选内容,并将其粘贴到新文档中。

示例代码
if(Selection.Type == wdSelectionNormal) {
    Selection.Cut()
    Documents.Add().Content.Paste()
}


请参阅