附件组件在线查看平台默认的是用浏览器的另一个页签打开的,如果需要在当前页面中显示可以如下操作
1.js定义的define中引用

var officeViewer = require('$UI/system/components/justep/docCommon/officeViewer');
var $OV = officeViewer.$OV;
var OV = officeViewer.OV;

2.在.w中定义一个div


<div xid="officeViewer" />

3.在div中创建ocx并打开文件

		var data = this.comp("mainData");
		var fFJ = data.getValue("fFJ");
		var jsonList = eval("(" + fFJ + ")");// 获取附件组件的json值
		var url = "";
		var type = "";
		if (jsonList.length > 0) {// 遍历json获取相关的信息
			for (var i = 0; i < jsonList.length; i++) {
				var docPath = jsonList[0]["docPath"];
				var fileID = jsonList[0]["fileID"];
				var docName = jsonList[0]["docName"];
				url = DocUtils.InnerUtils.getdocServerAction({
					"docPath" : docPath,
					urlPattern : "/repository/file/view/" + fileID + "/last/content",
					isFormAction : false,
					context : this.getContext(),
					useCookie : false
				});// 调用API获取url
				url = url.indexOf(window.location.protocol) < 1 ? url : window.location.protocol + "//" + window.location.host + url; //拼接最终需要的url
				var fileType = docName.substring(docName.indexOf("."));// 获取文件的后缀判断设置不同的类型
				if (fileType == ".doc" || fileType == ".docx")
					type = "Word.Application";
				else if (fileType == ".xls" || fileType == ".xlsx")
					type = "Excel.Application"
			}
		}
		var divID = this.getIDByXID("officeViewer");
		var ocxID = divID + "_ocx";
		if (event.tab.select().find("a").html() == 'officeViewer') {
			if (!$(".officeViewr").length > 0) {
				$("#" + divID).append('<div class="officeViewr" style="overflow:hidden;width:100%;height:100%;"><div style="overflow:auto;width:100%;height:100%;" id="' + ocxID + '"></div></div>');
			}
			$('#' + ocxID).attr('showToolbar', false);// 隐藏工具栏
			$OV(ocxID).CreateOfficeViewer('100%', '100%');
			var officeObj = $OV(ocxID);
			officeObj.ShowMenubar(false);// 隐藏菜单栏
			if (type && !officeObj.isOpened()) {
				officeObj.Open(url, type);
			} else
				return;
		}	

显示效果如下:
office