fanxw 发表于 2018-11-26 09:03:15

word文档如何套红?

发文流程节点有一步是套红和盖章,请问如何使用?

fanxw 发表于 2018-12-3 09:43:19

非常感谢您的回复。

fanxw 发表于 2018-11-26 09:49:02

@管理员,自己先顶一下。

论坛管理员 发表于 2018-11-27 10:05:59

O2支持NTKO控件,NTKO控件需自行采购。盖章需与具体使用的盖章系统做对接,没有通用代码。
详细实现套红信息在过程如下:
1、做好套红模板,上传到流程应用的附件配置中去
http://www.o2server.io:20020/x_file_assemble_control/jaxrs/file/02350276-b45d-4c2b-bf1c-3ad045a6fbd9/download/stream
2、表单上拖入OFFICE控件,控件属性的工具栏有很多工具按钮,其中包括套红按钮
http://www.o2server.io:20020/x_file_assemble_control/jaxrs/file/e68b5c07-4151-4af8-a4c0-defd4b1a7292/download/stream
3、套红按钮对应OFFICE控件的事件中的redFile事件,在该事件中实现具体套红代码,使用书签方式套红。
http://www.o2server.io:20020/x_file_assemble_control/jaxrs/file/b4bbceae-6eef-48e2-ba58-7b207ea59610/download/stream
4、代码样例如下:
var office = this.target;
var sel = this.form.getField("select");
var type = sel.getData();
//alert(type);
var select = this.form.getField("select");
var guanzi = select.getData();
if (!type) {
    this.form.getApp().notice("请先选择文件类型", "error", this.target.node);
} else {
    var dict = new this.Dict("fileSource");
    var url = dict.get("fileType." + type);//根据表单选择的文件类型来获取要套红哪个模板
    if (url) {
      url = MWF.Actions.getHost("x_processplatform_assemble_surface") + url;
      try {
            office.stopRevisions(true);
            office.officeOCX.ActiveDocument.Application.Selection.WholeStory();
            office.officeOCX.ActiveDocument.Application.Selection.Font.Name = "仿宋";
            office.officeOCX.ActiveDocument.Application.Selection.Font.Size = 16;
            office.officeOCX.ActiveDocument.Application.Selection.Cut();
            office.officeOCX.OpenFromUrl(url, false);
            var mark = office.officeOCX.ActiveDocument.Bookmarks("bodyCw");
            mark.Range.Paste();
            
            try {
                mark = office.officeOCX.ActiveDocument.Bookmarks("fileNoYearCw");
                mark.Range.text = this.data.fileno;
            } catch (e) {}
            
            try {
                mark = office.officeOCX.ActiveDocument.Bookmarks("fileNoCw");
                mark.Range.text = this.data.fileno_1;
            } catch (e) {}
            
            try {
                mark = office.officeOCX.ActiveDocument.Bookmarks("mainSendCw");
                var mainSendTexts = [];
                this.data.mainSend.each(function (o) {
                  mainSendTexts.push(o.name);
                });
                mark.Range.text = mainSendTexts.join(",");
            } catch (e) {}
            try {
                mark = office.officeOCX.ActiveDocument.Bookmarks("subjectCw");
                mark.Range.text = this.data.subject;
            } catch (e) {}
            try {
                mark = office.officeOCX.ActiveDocument.Bookmarks("subSendCw");
                var subSendTexts = [];
                if (this.data.copySend || this.data.copySendOut) {
                  this.data.copySend.each(function (o) {
                        subSendTexts.push(o.name);
                  });
                  mark.Range.text = "抄送:" + subSendTexts.join(",");
                }
            } catch (e) {}
            try {
                mark = office.officeOCX.ActiveDocument.Bookmarks("yfsjCw");
                mark.Range.text = dText;
            } catch (e) {}
            try {
                mark = office.officeOCX.ActiveDocument.Bookmarks("attachmentListCw");
                //get fj list
                var fjvalues = this.workContext.getAttachmentList();
                var fjTexts = new Array();
                for (var i = 0; i < fjvalues.length; i++) {
                  if (fjvalues.site != "office" && fjvalues.site != "officehistory") {
                        fjTexts.push(fjvalues.name);
                  }
                }
                mark.Range.text = "附件:" +"\r\n" + fjTexts.join("\r\n");
            } catch (e) {}
      } catch (e) {}
    }
}

fanxw 发表于 2018-11-26 14:51:48

@管理员,自己再顶一下。

论坛管理员 发表于 2018-12-19 20:26:31

结贴
页: [1]
查看完整版本: word文档如何套红?