ExcelPrint-II.xrw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet href="../../css/body.css" type="text/css" ?>
  3. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  4. <xhtml:head>
  5. <xhtml:title>Untitle</xhtml:title>
  6. <model id="model1">
  7. <instance id="instance1">
  8. <root xmlns="">
  9. <formData>
  10. <LgCd/>
  11. </formData>
  12. <LovData>
  13. <LgCd/>
  14. </LovData>
  15. <gridData/>
  16. <reqData/>
  17. <resData/>
  18. <headLine>
  19. <ListResult_1_VO>
  20. <ListResult_1_Row>
  21. <LG_CD>热连轧成品出库班报表</LG_CD>
  22. <SM_CD/>
  23. <LG_NM/>
  24. <SM_CFNM/>
  25. <SM_CSNM/>
  26. <SM_EFNM/>
  27. <SM_ESNM/>
  28. <BIZ_CLF/>
  29. <CD_SEQ/>
  30. <USED_YN/>
  31. <CD_DESC/>
  32. <CD_LEN/>
  33. <MOD_ID/>
  34. <MOD_DATE/>
  35. </ListResult_1_Row>
  36. <ListResult_1_Row>
  37. <LG_CD>日期</LG_CD>
  38. <SM_CD/>
  39. <LG_NM/>
  40. <SM_CFNM/>
  41. <SM_CSNM/>
  42. <SM_EFNM/>
  43. <SM_ESNM/>
  44. <BIZ_CLF/>
  45. <CD_SEQ/>
  46. <USED_YN/>
  47. <CD_DESC/>
  48. <CD_LEN/>
  49. <MOD_ID/>
  50. <MOD_DATE>
  51. <![CDATA[班组 & 班次]]>
  52. </MOD_DATE>
  53. </ListResult_1_Row>
  54. </ListResult_1_VO>
  55. </headLine>
  56. <subTitle>
  57. <ListResult_1_VO>
  58. <ListResult_1_Row>
  59. <LG_CD>大分类代码</LG_CD>
  60. <SM_CD>小分类代码</SM_CD>
  61. <LG_NM>大分类名</LG_NM>
  62. <SM_CFNM>小分类名(中文)</SM_CFNM>
  63. <SM_CSNM>小分类略称(中文)</SM_CSNM>
  64. <SM_EFNM>小分类名(英文)</SM_EFNM>
  65. <SM_ESNM>小分类略称(英文)</SM_ESNM>
  66. <BIZ_CLF>业务领域区分</BIZ_CLF>
  67. <CD_SEQ>标示顺序</CD_SEQ>
  68. <USED_YN>使用与否</USED_YN>
  69. <CD_DESC>代码说明</CD_DESC>
  70. <CD_LEN>使用代码长度</CD_LEN>
  71. <MOD_ID>最终修改人</MOD_ID>
  72. <MOD_DATE>最终修改时间</MOD_DATE>
  73. </ListResult_1_Row>
  74. </ListResult_1_VO>
  75. </subTitle>
  76. <gridData-II/>
  77. </root>
  78. </instance>
  79. </model>
  80. <script type="javascript" src="../../js/boaCommon.js"/>
  81. <script type="javascript" src="../../js/boaMsg.js"/>
  82. <script type="javascript" src="../../js/mesCommon.js"/>
  83. <script type="javascript" src="../../js/dCommon.js"/>
  84. <script type="javascript" ev:event="xforms-ready">
  85. <![CDATA[
  86. commSendReq("/root/formData");
  87. commSubmit("ExcelPrint-service" ,"success" ,"glueAction.do" );
  88. errorMessage();
  89. // The first added "ALL" in LgCd LOV
  90. model.makeValue("/root/LOVData/LgCd/LOVResult_1_Row[1]/LgNm" , "(ALL)" );
  91. model.makeValue("/root/LOVData/LgCd/LOVResult_1_Row[1]/LgCd" , "%" );
  92. var iRows = model.getXPathValue("count(/root/resData/LOVResult_1_VO/LOVResult_1_Row)");
  93. for( var i = 1; i <= iRows; i++ ) {
  94. model.makeValue("/root/LOVData/LgCd/LOVResult_1_Row["+ (i + 1) +"]/LgNm" , model.getValue("/root/resData/LOVResult_1_VO/LOVResult_1_Row["+ i +"]/LG_NM"));
  95. model.makeValue("/root/LOVData/LgCd/LOVResult_1_Row["+ (i + 1) +"]/LgCd" , model.getValue("/root/resData/LOVResult_1_VO/LOVResult_1_Row["+ i +"]/LG_CD"));
  96. }
  97. model.refresh();
  98. LgCd.select(0);
  99. ]]>
  100. </script>
  101. <script type="javascript">
  102. <![CDATA[
  103. function find() {
  104. commSendReq("/root/formData");
  105. commSubmit("ExcelPrint-service" ,"find" ,"glueAction.do" );
  106. //Populate HeadLine Information
  107. commAppendData ("/root/gridData/ListResult_1_VO" ,"/root/headLine/ListResult_1_VO" );
  108. //Populate SubTitle Information
  109. var iSubTitRows = Number(model.getXPathValue("count(/root/subTitle/ListResult_1_VO)") );
  110. for(var i = 1; i <= iSubTitRows ; i++) {
  111. model.duplicate("/root/gridData/ListResult_1_VO" ,"/root/subTitle/ListResult_1_VO/ListResult_1_Row["+ i +"]" );
  112. }
  113. //Populate Query-Results Information
  114. var nRows2 = dg2.rows - dg2.fixedRows + 1;
  115. var sCol_1 = "";
  116. var sCol_2 = "";
  117. var sCol_3 = "";
  118. var sCol_4 = "";
  119. var iQueryRows = Number(model.getXPathValue("count(/root/resData/ListResult_1_VO/ListResult_1_Row)" ));
  120. for(var i = 1; i <= iQueryRows ; i++) {
  121. model.duplicate("/root/gridData/ListResult_1_VO" ,"/root/resData/ListResult_1_VO/ListResult_1_Row["+ i +"]" );
  122. //alert("nRows2 = ["+ nRows2 +"]");
  123. //alert("k = ["+ k +"]\nCOL_1 = ["+ sCol_1 +"]\nCOL_2 = ["+ sCol_2 +"]\nCOL_3 = ["+ sCol_3 +"]\nCOL_4 = ["+ sCol_4 +"]");
  124. for(var k = nRows2; k <= (nRows2 + 5); k++) {
  125. if( ((k%5) == 1) || ((k%5) == 0) ) {
  126. sCol_1 = "";
  127. sCol_2 = "";
  128. sCol_3 = "";
  129. sCol_4 = "";
  130. if( (k%5) == 0 ) sCol_1 = "탕량 바보~";
  131. } else if( (k%5) == 2 ) {
  132. sCol_1 = "ROLL NO.";
  133. sCol_2 = model.getValue("/root/resData/ListResult_1_VO/ListResult_1_Row["+ i +"]/LG_CD" );
  134. sCol_3 = "COIL NO.";
  135. sCol_4 = model.getValue("/root/resData/ListResult_1_VO/ListResult_1_Row["+ i +"]/LG_NM" );
  136. } else if( (k%5) == 3 ) {
  137. sCol_1 = "HEAD NO.";
  138. sCol_2 = model.getValue("/root/resData/ListResult_1_VO/ListResult_1_Row["+ i +"]/SM_CD" );
  139. sCol_3 = "STEEL GRADE";
  140. sCol_4 = model.getValue("/root/resData/ListResult_1_VO/ListResult_1_Row["+ i +"]/SM_CFNM" );
  141. } else if( (k%5) == 4 ) {
  142. sCol_1 = "CONTRACT NO.";
  143. sCol_2 = model.getValue("/root/resData/ListResult_1_VO/ListResult_1_Row["+ i +"]/MOD_ID" );
  144. sCol_3 = "WEIGHT";
  145. sCol_4 = model.getValue("/root/resData/ListResult_1_VO/ListResult_1_Row["+ i +"]/USED_YN" );
  146. }
  147. model.makeValue("/root/gridData-II/ListResult_1_VO/ListResult_1_Row["+ k +"]/COL_1" , sCol_1 );
  148. model.makeValue("/root/gridData-II/ListResult_1_VO/ListResult_1_Row["+ k +"]/COL_2" , sCol_2 );
  149. model.makeValue("/root/gridData-II/ListResult_1_VO/ListResult_1_Row["+ k +"]/COL_3" , sCol_3 );
  150. model.makeValue("/root/gridData-II/ListResult_1_VO/ListResult_1_Row["+ k +"]/COL_4" , sCol_4 );
  151. } // end for( k...)
  152. nRows2 = nRows2 + 5;
  153. }
  154. model.refresh();
  155. //Hidden TITLE Information
  156. var iHiddenRows = Number(model.getXPathValue("count(/root/headLine/ListResult_1_VO/ListResult_1_Row)")) + iSubTitRows + (dg1.fixedRows - 1);
  157. for(var i = dg1.fixedRows; i <= iHiddenRows ; i++) {
  158. dg1.rowHidden(i) = true;
  159. }
  160. dg1.isSelected(iHiddenRows + 1) = true;
  161. }
  162. function saveExcelScript(sDGridName, sExcelSheetName, saveType) {
  163. var sExcelName = window.fileDialog( "save", "", false, "SaveFileName", "xls", "Excel Files(*.xls)|*.xls" );
  164. if ( sExcelName == "" ) {
  165. return;
  166. }
  167. // var sCSVName = "C:\\TFSmartUpdater\\" + sExcelName.lastIndexOf(".") +".csv";
  168. var sCSVName = sExcelName +".csv";
  169. // alert("sExcelName = ["+ sExcelName +"]\nsCSVName = ["+ sCSVName + "]");
  170. eval(sDGridName).saveText(sCSVName, "\n", ",", '\:', true); //DataGrid의 내용을 CSV파일로 생성
  171. ObjTFExcel.launchNewInstance(0); //Execute EXCEL
  172. ObjTFExcel.createWorkbook(); //Create new Workbook(for example:Sheet1,Sheet2,Sheet3) -- createWorkBook(Excel-TemplateFile)
  173. ObjTFExcel.loadCSV(sCSVName); //Loading Contents, from CSV to Excel
  174. //Setting up EXCEL Layout.
  175. var nRows = sDGridName.rows - sDGridName.fixedRows + 1; //Keep Careful !!!
  176. var nCols = sDGridName.cols;
  177. //All of the range
  178. ObjTFExcel.fontcolor ( 01, 01, nRows, nCols ) = "#000000" ;
  179. ObjTFExcel.font ( 01, 01, nRows, nCols ) = "SimSun" ;
  180. ObjTFExcel.setBorderColor( 01, 01, nRows, nCols, "#000000") ;
  181. ObjTFExcel.bold ( 01, 01, nRows, nCols ) = true ;
  182. ObjTFExcel.fontsize ( 01, 01, nRows, nCols ) = 12 ;
  183. ObjTFExcel.underline ( 01, 01, nRows, nCols ) = 0 ;
  184. ObjTFExcel.valign ( 01, 01, nRows, nCols ) ="middle" ;
  185. ObjTFExcel.halign ( 01, 02, nRows, nCols ) ="left" ;
  186. //Query-Results Data
  187. var iRow = 1; // iRow = HeaderLine + 1;
  188. for(var i = iRow; i <= nRows; i++ ) {
  189. if( (i%5) == 1 ) {
  190. ObjTFExcel.rowHeight( i ) = 60;
  191. ObjTFExcel.mergeCell( i, 01, i, nCols );
  192. } else if( (i%5) == 0 ) {
  193. ObjTFExcel.rowHeight( i ) = 45;
  194. ObjTFExcel.mergeCell( i, 01, i, nCols );
  195. } else {
  196. ObjTFExcel.rowHeight( i ) = 40;
  197. }
  198. }
  199. ObjTFExcel.colwidth ( 01 ) = 20 ;
  200. ObjTFExcel.colwidth ( 02 ) = 20 ;
  201. ObjTFExcel.colwidth ( 03 ) = 20 ;
  202. ObjTFExcel.colwidth ( 04 ) = 20 ;
  203. // ObjTFExcel.setFormat(iRow, 14, nRows, 14, "yyyy\"-\"mm\"-\"dd\"\" hh\":\"mm\":\"ss\"\";@");
  204. ObjTFExcel.sheetName(1) = sExcelSheetName;
  205. ObjTFExcel.save(sExcelName); //Saving EXCEL
  206. ObjTFExcel.close(); //Closing EXCEL. (You must be closed EXCEL !!!)
  207. window.exec("EXCEL.EXE", sExcelName); //Openning EXCEL
  208. }
  209. ]]>
  210. </script>
  211. </xhtml:head>
  212. <xhtml:body>
  213. <caption id="caption1" style="left:10px; top:10px; width:290px; height:25px; font-weight:bold; color:#0000ff; vertical-align:middle; ">※. ExcelPrint Example</caption>
  214. <object id="ObjTFExcel" clsid="{fe8d1001-6a9d-424d-ae2a-301493bb12da}" style="left:320px; top:10px; width:155px; height:25px; "/>
  215. <button id="button1" style="left:860px; top:15px; width:90px; height:21px; background-color:#c0c0c0; ">
  216. <caption>EXCEL</caption>
  217. <script type="javascript" ev:event="DOMActivate">
  218. <![CDATA[
  219. saveExcelScript(dg1, "Sheet1");
  220. ]]>
  221. </script>
  222. </button>
  223. <line id="line1" style="x1:300px; y1:34px; x2:10px; y2:34px; border-color:#0000ff; "/>
  224. <datagrid id="dg1" nodeset="/root/gridData/ListResult_1_VO/ListResult_1_Row" caption="LG_CD^SM_CD^LG_NM^SM_CFNM^SM_CSNM^SM_EFNM^SM_ESNM^BIZ_CLF^CD_SEQ^USED_YN^CD_DESC^CD_LEN^MOD_ID^MOD_DATE|LG_CD^SM_CD^LG_NM^SM_CFNM^SM_CSNM^SM_EFNM^SM_ESNM^BIZ_CLF^CD_SEQ^USED_YN^CD_DESC^CD_LEN^MOD_ID^MOD_DATE" colsep="^" colwidth="60, 60, 100, 100, 100, 100, 100, 65, 70, 65, 100, 65, 70, 120" mergecellsfixedrows="bycolrec" rowsep="|" style="left:10px; top:50px; width:940px; height:450px; ">
  225. <col editable="false" ref="LG_CD" type="input" style="text-align:left; "/>
  226. <col editable="false" ref="SM_CD" type="input" style="text-align:left; "/>
  227. <col editable="false" ref="LG_NM" type="input" style="text-align:left; "/>
  228. <col editable="false" ref="SM_CFNM" type="input" style="text-align:left; "/>
  229. <col editable="false" ref="SM_CSNM" type="input" style="text-align:left; "/>
  230. <col editable="false" ref="SM_EFNM" type="input" style="text-align:left; "/>
  231. <col editable="false" ref="SM_ESNM" type="input" style="text-align:left; "/>
  232. <col editable="false" ref="BIZ_CLF" type="input" style="text-align:center; "/>
  233. <col editable="false" ref="CD_SEQ" type="input" style="text-align:right; "/>
  234. <col editable="false" ref="USED_YN" type="input" style="text-align:center; "/>
  235. <col editable="false" ref="CD_DESC" type="input" style="text-align:left; "/>
  236. <col editable="false" ref="CD_LEN" type="input" style="text-align:right; "/>
  237. <col editable="false" ref="MOD_ID" type="input" style="text-align:left; "/>
  238. <col editable="false" ref="MOD_DATE" type="input" style="text-align:center; "/>
  239. </datagrid>
  240. <datagrid id="dg2" nodeset="/root/gridData-II/ListResult_1_VO/ListResult_1_Row" caption="COL_1^COL_2^COL_3^COL_4|COL_1^COL_2^COL_3^COL_4" colsep="^" colwidth="100, 100, 100, 100" mergecellsfixedrows="bycolrec" rowsep="|" style="left:955px; top:50px; width:400px; height:450px; ">
  241. <col editable="false" ref="COL_1" type="input" style="text-align:left; "/>
  242. <col editable="false" ref="COL_2" type="input" style="text-align:left; "/>
  243. <col editable="false" ref="COL_3" type="input" style="text-align:left; "/>
  244. <col editable="false" ref="COL_4" type="input" style="text-align:left; "/>
  245. </datagrid>
  246. <button id="button2" style="left:765px; top:15px; width:90px; height:21px; background-color:#c0c0c0; ">
  247. <caption>FIND</caption>
  248. <script type="javascript" ev:event="DOMActivate">
  249. <![CDATA[
  250. find();
  251. ]]>
  252. </script>
  253. </button>
  254. <select1 id="LgCd" ref="/root/formData/LgCd" appearance="minimal" style="left:495px; top:15px; width:165px; height:21px; ">
  255. <choices>
  256. <itemset nodeset="/root/LOVData/LgCd/LOVResult_1_Row">
  257. <label ref="LgNm"/>
  258. <value ref="LgCd"/>
  259. </itemset>
  260. </choices>
  261. </select1>
  262. <button id="button3" style="left:860px; top:15px; width:90px; height:21px; background-color:#c0c0c0; ">
  263. <caption>EXCEL</caption>
  264. <script type="javascript" ev:event="DOMActivate">
  265. <![CDATA[
  266. saveExcelScript(dg2, "Sheet1");
  267. ]]>
  268. </script>
  269. </button>
  270. </xhtml:body>
  271. </xhtml:html>