ntko execl操作[通俗易懂]

2022-11-16 18:33:17 浏览数 (2)

<OBJECT id=TANGER_OCX codeBase=”http://www.ntko.com/control/officecontrol/OfficeControl.cab#Version=5.0.2.5″ classid=clsid:A39F1330-3322-4a1d-9BF0-0BA2BB90E970 width=”100%” height=”100%”><PARAM NAME=”_ExtentX” VALUE=”19923″><PARAM NAME=”_ExtentY” VALUE=”12700″><PARAM NAME=”BorderColor” VALUE=”14402205″><PARAM NAME=”BackColor” VALUE=”-2147483643″><PARAM NAME=”ForeColor” VALUE=”-2147483640″><PARAM NAME=”TitlebarColor” VALUE=”42768″><PARAM NAME=”TitlebarTextColor” VALUE=”0″><PARAM NAME=”BorderStyle” VALUE=”1″><PARAM NAME=”Titlebar” VALUE=”0″><PARAM NAME=”Toolbars” VALUE=”0″><PARAM NAME=”Caption” VALUE=”欢迎使用!”><PARAM NAME=”IsShowToolMenu” VALUE=”1″><PARAM NAME=”IsNoCopy” VALUE=”0″><PARAM NAME=”IsHiddenOpenURL” VALUE=”0″><PARAM NAME=”MaxUploadSize” VALUE=”0″><PARAM NAME=”NetworkBufferSize” VALUE=”0″><PARAM NAME=”Menubar” VALUE=”1″><PARAM NAME=”Statusbar” VALUE=”1″><PARAM NAME=”FileNew” VALUE=”-1″><PARAM NAME=”FileOpen” VALUE=”-1″><PARAM NAME=”FileClose” VALUE=”-1″><PARAM NAME=”FileSave” VALUE=”-1″><PARAM NAME=”FileSaveAs” VALUE=”-1″><PARAM NAME=”FilePrint” VALUE=”-1″><PARAM NAME=”FilePrintPreview” VALUE=”-1″><PARAM NAME=”FilePageSetup” VALUE=”-1″><PARAM NAME=”FileProperties” VALUE=”-1″><PARAM NAME=”IsStrictNoCopy” VALUE=”0″><PARAM NAME=”IsUseUTF8URL” VALUE=”1″><PARAM NAME=”MenubarColor” VALUE=”14402205″><PARAM NAME=”IsUseControlAgent” VALUE=”0″><PARAM NAME=”IsUseUTF8Data” VALUE=”0″><PARAM NAME=”IsSaveDocExtention” VALUE=”0″><PARAM NAME=”IsDirectConnect” VALUE=”0″><PARAM NAME=”SignCursorType” VALUE=”0″><PARAM NAME=”IsResetToolbarsOnOpen” VALUE=”0″><PARAM NAME=”IsSaveDataIfHasVDS” VALUE=”0″><PARAM NAME=”MenuButtonStyle” VALUE=”7″><PARAM NAME=”MenuButtonColor” VALUE=”16180947″><PARAM NAME=”MenuButtonFrameColor” VALUE=”14924434″><PARAM NAME=”MenuBarStyle” VALUE=”3″><PARAM NAME=”IsGetPicOnlyOnHandSign” VALUE=”0″><PARAM NAME=”IsSecurityOptionsOpen” VALUE=”0″><PARAM NAME=”IsShowHelpMenu” VALUE=”0″><PARAM NAME=”IsShowInsertMenu” VALUE=”1″><PARAM NAME=”IsAutoDetectWebCharSet” VALUE=”0″><PARAM NAME=”WebCodePage” VALUE=”936″><PARAM NAME=”IsShowEditMenu” VALUE=”1″><PARAM NAME=”IsShowFileErrorMsg” VALUE=”1″><PARAM NAME=”IsShowNetErrorMsg” VALUE=”1″><PARAM NAME=”ReceiveDataTimeOut” VALUE=”180″><PARAM NAME=”ConnectServerTimeOut” VALUE=”180″><PARAM NAME=”IsRemoveMacrosOnSave” VALUE=”1″><PARAM NAME=”IsForceCheckSecSignCertCRLOnline” VALUE=”0″><PARAM NAME=”IsAutoLockOnSecSign” VALUE=”0″><PARAM NAME=”IsAllowAddSignOnLockedDoc” VALUE=”0″><PARAM NAME=”DefaultOpenDocType” VALUE=”0″><PARAM NAME=”IsShowFullScreenButton” VALUE=”-1″><PARAM NAME=”IsEnableDoubleClickFSM” VALUE=”-1″><PARAM NAME=”IsExcelAutoCalIncludeHidden” VALUE=”0″><PARAM NAME=”MaxNetworkBufferSize” VALUE=”8388608″><PARAM NAME=”IsEnableWordConverters” VALUE=”0″><PARAM NAME=”IsSave2007InnerFmt” VALUE=”0″><PARAM NAME=”EkeyType” VALUE=”1″><PARAM NAME=”CustomToolBar” VALUE=”0″><PARAM NAME=”IsOptForOpenSpeed” VALUE=”0″><PARAM NAME=”IsAllowEkeyOnlySignDemo” VALUE=”0″><PARAM NAME=”OptMSDocApp” VALUE=”0″><PARAM NAME=”IsUserDDE” VALUE=”0″><PARAM NAME=”IsEnableOtherPdfViewer” VALUE=”1″><PARAM NAME=”IsCheckEkey” VALUE=”0″><PARAM NAME=”MenuButtonDefaultColor” VALUE=”0″><PARAM NAME=”IsDebugNoDelfile” VALUE=”0″><PARAM NAME=”IsDebugLogDelfile” VALUE=”0″><PARAM NAME=”IsShowDocStatusInfo” VALUE=”1″><PARAM NAME=”IsFastSaveHandSign2″ VALUE=”0″><PARAM NAME=”IsSetShowFieldsValue” VALUE=”0″><PARAM NAME=”IsSetIEUploadFileContainLocalDir” VALUE=”1″><PARAM NAME=”IsSetSvrSignBelowText” VALUE=”0″><PARAM NAME=”IsUseOfficeConvertDocToPDF” VALUE=”0″><PARAM NAME=”MultiSecSignMarginSize” VALUE=”5″><PARAM NAME=”UseSignPartProtectDoc” VALUE=”0″><PARAM NAME=”SetMultiSecSignPosition” VALUE=”-1″><PARAM NAME=”IsAddRandomOffsetForMultiSecSign” VALUE=”0″></OBJECT>

function setObject(myParam)

{ var TANGER_OCX_OBJ = document.all(“TANGER_OCX”); TANGER_OCX_OBJ.CreateNew(“Excel.Sheet”);//创建Sheet TANGER_OCX_OBJ.SetSheetName(1, “NeededList”);//修改SheetName TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1”).ColumnWidth=50/8; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“B1”).ColumnWidth=130/8; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“C1”).ColumnWidth=200/8; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“D1”).ColumnWidth=100/8; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“E1”).ColumnWidth=100/8; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“F1”).ColumnWidth=430/8; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).PageSetup.Orientation = 2;//默认横向打印 var sSQL=”select * from PR_PM_NeededList where PR_PM_NeededListUID='” myParam ”‘ “; var jsonData = CXJLib.Runtime.Engine.RunSQLGetDataSet(sSQL); if(jsonData != null && jsonData.length>0) { TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1:F2”).Font.Bold = true;//加粗 1行和2行都执行此样式 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1:F2”).HorizontalAlignment = -4108;//水平居中 1行和2行都执行此样式 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1:F2”).Borders.LineStyle = 1;//边框 1行和2行都执行此样式 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1:F1”).MergeCells = true;//合并 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1:F1”).Font.Size = 16;//字号 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1”).Value = “NAMIBIAN POLICE”;//设置内容 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A2:F2”).MergeCells = true; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A2”).Value = “Needed List”; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A2:F2”).Font.Size = 14;//字号

TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A3:C3”).MergeCells = true; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A3”).Value = “NEEDED NO:” decodeURIComponent(jsonData[0].NeededNo); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A4:C4”).MergeCells = true; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A4”).Value = “DEPOT:” decodeURIComponent(jsonData[0].Depot); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“D3:F3”).MergeCells = true; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“D3”).Value = “REQUEST DATE:” decodeURIComponent(jsonData[0].ReqDate); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“D4:F4”).MergeCells = true; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“D4”).Value = “STORE:” decodeURIComponent(jsonData[0].Store); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A5:F5”).MergeCells = true; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A5”).Value = “DESCRIPTION:” decodeURIComponent(jsonData[0].Description); sSQL=”select * from PR_PM_NeededListDetail where PR_PM_NeededListUID='” myParam ”‘ “; jsonData = CXJLib.Runtime.Engine.RunSQLGetDataSet(sSQL); if(jsonData != null && jsonData.length>0) { TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A6:F6”).HorizontalAlignment = -4108;//水平居中 1行和2行都执行此样式 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A6”).Value = “LINE NO.”; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“B6”).Value = “ICN”; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“C6”).Value = “ITEM Description”; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“D6”).Value = “DOQ”; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“E6”).Value = “QTY”; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“F6”).Value = “Description”; var sumrow=6 jsonData.length; var rownum = 7; for(i=0;i<jsonData.length;i ){ rownum =i; TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A” rownum).Value = decodeURIComponent(jsonData[i].Child_Index); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“B” rownum).Value = decodeURIComponent(jsonData[i].MaterialNo); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“C” rownum).Value = decodeURIComponent(jsonData[i].MaterialDesc); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“D” rownum).Value = decodeURIComponent(jsonData[i].MaterialDOQ); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“E” rownum).Value = decodeURIComponent(jsonData[i].MaterialQty); TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“F” rownum).Value = decodeURIComponent(jsonData[i].Description); } TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A6:F” sumrow).Borders.LineStyle = 1;//边框 1行和2行都执行此样式 TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A7:F” sumrow).WrapText=true; } } else { TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Range(“A1”).Value = “No Data”; } TANGER_OCX_OBJ.ActiveDocument.Sheets(1).Application.Quit(); }

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/234706.html原文链接:https://javaforall.cn

0 人点赞