Usable Range
Process
CMS
Portal
Example
//可以在脚本中获取该组件
//方法1:
var wpsOffice = this.form.get("fieldId"); //获取组件
//方法2
var wpsOffice = this.target; //在组件本身的脚本中获取
Source
Members
nodeElement
组件的节点,mootools封装过的Dom对象,可以直接使用原生的js和moootools方法访问和操作该对象。
Type
-
Element
Overrides
See
Example
//可以在脚本中获取该组件
var field = this.form.get("fieldId"); //获取组件对象
field.node.setStyle("font-size","12px"); //给节点设置样式
Source
jsonJsonObject
组件的配置信息,比如id,类型,是否只读等等。可以在组件的queryLoad事件里修改该配置来对组件做一些改变。
Type
-
JsonObject
Example
//可以在脚本中获取该组件
var json = this.form.get("fieldId").json; //获取组件对象
var id = json.id; //获取组件的id
var type = json.type; //获取组件的类型,如Textfield 为文本输入组件,Select为下拉组件
//在组件queryLoad事件里设置组件只读。
//当前组件的queryLoad事件运行时还没有在form里注册,通过this.form.get("fieldId")不能获取到当前组件,需要用this.target获取。
var json = this.target.json;
json.isReadonly = true; //设置组件为只读。
Source
formMWF.xApplication.process.Xform.Form
组件的所在表单对象.
Type
Example
var form = this.form.get("fieldId").form; //获取组件所在表单对象
var container = form.container; //获取表单容器
Source
parentLineMWF.xApplication.process.Xform.Datatemplate.Line|MWF.xApplication.process.Xform.DatatablePC.Line|MWF.xApplication.process.Xform.DatatableMobile.Line
当前组件在数据表格或者数据模板中时,可以通过此属性获取所在行(条目)对象.
Type
-
MWF.xApplication.process.Xform.Datatemplate.Line
|MWF.xApplication.process.Xform.DatatablePC.Line
|MWF.xApplication.process.Xform.DatatableMobile.Line
Inherited From
Example
//获取当前组件所在数据模板/数据表格的行(条目)对象
var line = this.target.parentLine;
//获取当前字段所在行下标
var index = line.getIndex();
//获取当前字段所在条目的subject字段的值
var data = line.getModule("subject").getData();
//设置当前字段所在条目的subject字段的值
line.getModule("subject").setData("test1");
Source
Methods
save()
Summary
保存wps
Example
this.form.get("fieldId").save(callback)
Source
sendBroadcast()
Summary
发送全局广播
Example
this.form.get("fieldId").sendBroadcast("测试")
Source
getTotalPage()
Summary
获取word页面总数,
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").getTotalPage()
Source
getCurrentPage()
Summary
获取当前页
Example
this.form.get("fieldId").getCurrentPage()
Source
gotoPage()
Summary
跳转到指定页
Example
this.form.get("fieldId").gotoPage(page)
Source
getAllBookmark()
Summary
获取所有书签
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").getAllBookmark()
Source
getBookmarkText()
Summary
获取书签值
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").getBookmarkText()
Source
gotoBookmark()
Summary
跳转到书签
Example
this.form.get("fieldId").gotoBookmark()
Source
setBookmarkText()
Summary
给书签赋值
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").setBookmarkText(name,value)
Source
setSeal()
Summary
盖章
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").setSeal(bookmark,img,left,top,width,height)
Source
replaceText()
Summary
查找替换
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").replaceText(key,value)
Source
startRevisions()
Summary
开启修订模式
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").startRevisions()
Source
stopRevisions()
Summary
关闭修订模式
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").stopRevisions()
Source
acceptAllRevisions()
Summary
接受所有修订
Example
this.form.get("fieldId").acceptAllRevisions()
Source
rejectAllRevisions()
Summary
拒绝所有修订
Example
this.form.get("fieldId").rejectAllRevisions()
Source
showRevisions()
Summary
显示痕迹
Example
this.form.get("fieldId").showRevisions()
Source
hideRevisions()
Summary
隐藏痕迹
Example
this.form.get("fieldId").hideRevisions()
Source
print()
Summary
打印
Example
this.form.get("fieldId").print()
Source
exportPDF()
Summary
导出pdf
Example
this.form.get("fieldId").exportPDF()
Source
getOperatorsInfo()
Summary
获取文档权限信息
Example
this.form.get("fieldId").getOperatorsInfo()
Source
getContentControlsCount()
Summary
获取内容控件个数
Returns
-
返回是个Promise对象
Example
this.form.get("fieldId").getContentControlsCount()
Source
getContentControlText()
Summary
获取内容控件文本
Example
this.form.get("fieldId").getContentControlText()
Source
setContentControlText()
Summary
设置内容控件文本
Example
this.form.get("fieldId").setContentControlText()
Source
getZoom()
Summary
获取文档缩放
Example
this.form.get("fieldId").getZoom()
Source
setZoom()
Summary
设置文档缩放
Example
this.form.get("fieldId").setZoom()
Source
hasComments()
Summary
是否有评论
Example
this.form.get("fieldId").hasComments()
Source
showComments()
Summary
显示评论
Example
this.form.get("fieldId").showComments()
Source
hideComments()
Summary
隐藏评论
Example
this.form.get("fieldId").hideComments()
Source
getComments()
Summary
获取所有评论
Example
this.form.get("fieldId").hideComments()
Source
showPageMode()
Summary
页面模式
Example
this.form.get("fieldId").showPageMode()
Source
showUnionPageMode()
Summary
连页模式
Example
this.form.get("fieldId").showPageMode()
Source
showFileName()
Summary
显示连页模式下的文件名
Example
this.form.get("fieldId").showFileName()
Source
hideFileName()
Summary
隐藏连页模式下的文件名
Example
this.form.get("fieldId").hideFileName()
Source
showDocumentMap()
Summary
显示导航目录
Example
this.form.get("fieldId").showDocumentMap()
Source
hideDocumentMap()
Summary
隐藏导航目录
Example
this.form.get("fieldId").hideDocumentMap()
Source
validate(routeNameopt) → {Boolean}
Summary
根据组件的校验设置进行校验。
Parameters
-
routeName
String
<optional>
可选,路由名称.
Inherited From
Returns
-
Boolean
是否通过校验
Example
if( !this.form.get('fieldId').validate() ){
return false;
}
Source
getSource(typeopt) → {Source|SubSource|SubSourceItem}
当前组件在数据源组件中时,可以通过此方法获取所在的上级数据源/子数据源/子数项组件.
Parameters
-
type
String
<optional>
需要获取的类型,"source"为表示数据源,"subSource"表示子数据源,"subSourceItem"表示子数据项组件。 如果该参数省略,则获取离当前组件最近的上述组件。
Inherited From
Returns
-
Source
SubSource
SubSourceItem
。
Example
var source = this.target.getSource(); //获取当前组件的所在子上级数据源/子数据源/子数项组件.
var data = source.data; //获取数据
var source = this.form.get("fieldId").getSource("source"); //获取数据源组件
var data = source.data; //获取数据
Source
getParentModule(typeopt, validateFunctionopt) → {MWF.xApplication.process.Xform.$Module}
获取当前组件所在的祖先组件.
Parameters
-
type
String
<optional>
需要获取的组件类型。 如果该参数省略,则获取离当前组件最近的祖先组件。type有效值如下:
form- 表单common- 通用组件datatable- 数据表格datatableline- 数据表格行datatemplate- 数据模板datatemplateline- 数据模板行div- 容器组件elcommon- Element通用组件elcontainer- Element容器组件subform- 子表单source- 数据源组件subsource- 子数据源subsourceitem- 子数据项组件tab- 分页组件tabpage- 分页组件的某个分页table- 表格tabletd- 单元格widget- 部件 -
validateFunction
function
<optional>
进一步校验,参数为获取到匹配到类型的组件,返回false继续往上取对应类型的组件,返回true返回该组件。
Inherited From
Returns
Example
var module = this.target.getParentModule(); //获取最近的祖先。
var datatemplateLine = this.target.getParentModule("datatemplateline"); //获取当前组件所在的数据模板行.
var module = this.target.getParentModule(null, function(module){
return module.json.id === "div_1";
}); //获取当前组件id为div_1的父组件。
Source
hide()
Summary
隐藏组件.
Example
this.form.get("fieldId").hide(); //隐藏组件
Source
show()
Summary
显示组件.
Example
this.form.get("fieldId").show(); //显示组件
Source
Events
beforeOpen
文档打开前事件。
Since
- V8.0
afterOpen
文档打开后事件。
Since
- V8.0
afterSave
保存后事件。
Since
- V8.0
queryLoad
组件加载前触发。queryLoad执行的时候,当前组件没有在form里注册,通过this.form.get("fieldId")不能获取到当前组件,需要用this.target获取。
postLoad
组件加载后触发.
load
组件加载后触发.