w_sentdataout.srw 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. $PBExportHeader$w_sentdataout.srw
  2. $PBExportComments$数据发送窗口
  3. forward
  4. global type w_sentdataout from w_publ_base
  5. end type
  6. type cb_backup from uo_imflatbutton within w_sentdataout
  7. end type
  8. type st_1 from statictext within w_sentdataout
  9. end type
  10. type sle_filename from singlelineedit within w_sentdataout
  11. end type
  12. type cb_ch from commandbutton within w_sentdataout
  13. end type
  14. type gb_1 from groupbox within w_sentdataout
  15. end type
  16. type ddlb_dataformat from dropdownlistbox within w_sentdataout
  17. end type
  18. end forward
  19. global type w_sentdataout from w_publ_base
  20. integer width = 1883
  21. integer height = 628
  22. string title = "数据发送"
  23. boolean minbox = false
  24. windowtype windowtype = response!
  25. cb_backup cb_backup
  26. st_1 st_1
  27. sle_filename sle_filename
  28. cb_ch cb_ch
  29. gb_1 gb_1
  30. ddlb_dataformat ddlb_dataformat
  31. end type
  32. global w_sentdataout w_sentdataout
  33. type variables
  34. DATAWINDOW OBJ_DW
  35. INT ddlb_dataformat_INDEX=1
  36. end variables
  37. on w_sentdataout.create
  38. int iCurrent
  39. call super::create
  40. this.cb_backup=create cb_backup
  41. this.st_1=create st_1
  42. this.sle_filename=create sle_filename
  43. this.cb_ch=create cb_ch
  44. this.gb_1=create gb_1
  45. this.ddlb_dataformat=create ddlb_dataformat
  46. iCurrent=UpperBound(this.Control)
  47. this.Control[iCurrent+1]=this.cb_backup
  48. this.Control[iCurrent+2]=this.st_1
  49. this.Control[iCurrent+3]=this.sle_filename
  50. this.Control[iCurrent+4]=this.cb_ch
  51. this.Control[iCurrent+5]=this.gb_1
  52. this.Control[iCurrent+6]=this.ddlb_dataformat
  53. end on
  54. on w_sentdataout.destroy
  55. call super::destroy
  56. destroy(this.cb_backup)
  57. destroy(this.st_1)
  58. destroy(this.sle_filename)
  59. destroy(this.cb_ch)
  60. destroy(this.gb_1)
  61. destroy(this.ddlb_dataformat)
  62. end on
  63. event open;call super::open;OBJ_DW=Message.PowerObjectParm
  64. IF OBJ_DW.DATAOBJECT='' THEN CLOSE(THIS)
  65. end event
  66. type cb_func from w_publ_base`cb_func within w_sentdataout
  67. boolean visible = false
  68. integer x = 64
  69. integer y = 388
  70. boolean enabled = false
  71. end type
  72. type cb_exit from w_publ_base`cb_exit within w_sentdataout
  73. integer x = 1138
  74. integer y = 388
  75. integer width = 320
  76. end type
  77. type cb_backup from uo_imflatbutton within w_sentdataout
  78. integer x = 453
  79. integer y = 388
  80. integer width = 320
  81. integer height = 96
  82. integer taborder = 60
  83. string text = "发送"
  84. end type
  85. event clicked;call super::clicked;Integer SAVE_RSLT = 0
  86. IF ddlb_dataformat_INDEX <> 4 AND Len(Trim(sle_filename.Text)) <= 5 THEN
  87. MessageBox('错误','请检查文件名!')
  88. RETURN
  89. END IF
  90. IF FileExists(sle_filename.Text) THEN
  91. IF MessageBox("系统提示","指定文件已经存在,是否覆盖该文件?",Question!,YesNo!,2) = 2 THEN
  92. RETURN
  93. END IF
  94. END IF
  95. CHOOSE CASE ddlb_dataformat_INDEX
  96. CASE 1 //EXCEL
  97. n_cst_dw2excel n_excel
  98. n_excel.OF_SetTipsWindow("w_tipsabc","正在生成Excel文件,请稍候.....")
  99. SAVE_RSLT = n_excel.OF_dw2Excel(obj_dw,sle_filename.Text)
  100. // SAVE_RSLT = gf_dw_to_excel (obj_dw, sle_filename.Text)
  101. CASE 2 //EXCEL
  102. SAVE_RSLT = obj_dw.SaveAsAscii(sle_filename.Text)
  103. CASE 3 //HTML
  104. SAVE_RSLT = obj_dw.SaveAs(sle_filename.Text,HTMLTable!,FALSE)
  105. CASE 4 //TEXT
  106. SAVE_RSLT = obj_dw.SaveAs(sle_filename.Text,Text!,FALSE)
  107. CASE 5 //CLB
  108. SAVE_RSLT = obj_dw.SaveAs(sle_filename.Text,Clipboard!,FALSE)
  109. CASE ELSE
  110. END CHOOSE
  111. IF SAVE_RSLT = 1 THEN
  112. MessageBox("成功信息","数据发送操作成功!")
  113. ELSE
  114. MessageBox("失败信息","数据发送操作失败!请检查目标文件名称是否拼写正确!")
  115. END IF
  116. //Clipboard! Save to the clipboard
  117. //CSV! ?Comma-separated values
  118. //dBASE2! ?dBASE-II format
  119. //dBASE3! ?dBASE-III format
  120. //DIF! ?Data Interchange Format
  121. //Excel! ?Microsoft Excel format
  122. //Excel5! ?Microsoft Excel 5 format
  123. //HTMLTable! ?Text with HTML formatting that approximates the DataWindow layout
  124. //PSReport! ?Powersoft Report (PSR) format
  125. //SQLInsert! ?SQL syntax
  126. //SYLK! ?Microsoft Multiplan format
  127. //Text! ?(Default) Tab-separated columns with a return at the end of each row
  128. //WKS! ?Lotus 1-2-3 format
  129. //WK1! ?Lotus 1-2-3 format
  130. //WMF! ?Windows Metafile format
  131. end event
  132. type st_1 from statictext within w_sentdataout
  133. integer x = 73
  134. integer y = 32
  135. integer width = 480
  136. integer height = 48
  137. integer textsize = -9
  138. integer weight = 400
  139. fontcharset fontcharset = gb2312charset!
  140. fontpitch fontpitch = variable!
  141. string facename = "宋体"
  142. long textcolor = 33554432
  143. long backcolor = 134217739
  144. string text = "目标发送数据格式:"
  145. boolean focusrectangle = false
  146. end type
  147. type sle_filename from singlelineedit within w_sentdataout
  148. integer x = 96
  149. integer y = 216
  150. integer width = 1559
  151. integer height = 92
  152. integer taborder = 50
  153. integer textsize = -9
  154. integer weight = 400
  155. fontcharset fontcharset = gb2312charset!
  156. fontpitch fontpitch = variable!
  157. string facename = "宋体"
  158. long textcolor = 33554432
  159. borderstyle borderstyle = stylelowered!
  160. end type
  161. type cb_ch from commandbutton within w_sentdataout
  162. integer x = 1659
  163. integer y = 216
  164. integer width = 114
  165. integer height = 92
  166. integer taborder = 60
  167. integer textsize = -9
  168. integer weight = 400
  169. fontcharset fontcharset = gb2312charset!
  170. fontpitch fontpitch = variable!
  171. string facename = "宋体"
  172. string text = "..."
  173. end type
  174. event clicked;string DATAFORMAT=''
  175. integer i
  176. string pathname,filename
  177. CHOOSE CASE ddlb_dataformat_INDEX
  178. CASE 1,2 //EXCEL
  179. DATAFORMAT='XLS'
  180. CASE 3 //HTML
  181. DATAFORMAT='HTML'
  182. CASE 4 //TEXT
  183. DATAFORMAT='TXT'
  184. CASE ELSE
  185. END CHOOSE
  186. i=getfilesavename("给予目标文件名",pathname,filename,DATAFORMAT,ddlb_dataformat.text+',*.'+DATAFORMAT)
  187. IF i=1 AND TRIM(pathname)<>'' AND TRIM(FILENAME)<>"" THEN
  188. sle_filename.text=pathname
  189. END IF
  190. end event
  191. type gb_1 from groupbox within w_sentdataout
  192. integer x = 32
  193. integer y = 136
  194. integer width = 1810
  195. integer height = 216
  196. integer taborder = 30
  197. integer textsize = -9
  198. integer weight = 400
  199. fontcharset fontcharset = gb2312charset!
  200. fontpitch fontpitch = variable!
  201. string facename = "宋体"
  202. long textcolor = 33554432
  203. long backcolor = 134217739
  204. string text = "发送的目标文件路径及名称"
  205. end type
  206. type ddlb_dataformat from dropdownlistbox within w_sentdataout
  207. integer x = 544
  208. integer y = 20
  209. integer width = 654
  210. integer height = 740
  211. integer taborder = 20
  212. boolean bringtotop = true
  213. integer textsize = -9
  214. integer weight = 400
  215. fontcharset fontcharset = gb2312charset!
  216. fontpitch fontpitch = variable!
  217. string facename = "宋体"
  218. long textcolor = 33554432
  219. boolean sorted = false
  220. boolean vscrollbar = true
  221. string item[] = {"Excel 完整(*.xls)","Excel 快速(*.xls)","HTML (*.htmL)","Text (*.txt)","剪切板"}
  222. borderstyle borderstyle = stylelowered!
  223. end type
  224. event constructor;if THIS.TotalItems ( )>=1 then THIS.SelectItem(1)
  225. end event
  226. event selectionchanged;ddlb_dataformat_INDEX=index
  227. IF INDEX =4 THEN
  228. sle_filename.ENABLED=FALSE
  229. cb_ch.ENABLED=FALSE
  230. ELSE
  231. sle_filename.ENABLED=TRUE
  232. cb_ch.ENABLED=TRUE
  233. END IF
  234. sle_filename.TEXT=''
  235. end event