Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

列印_預告訂單.vb 65KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. Option Strict Off
  2. Imports System.IO
  3. Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
  4. Imports Microsoft.Office.Interop.Excel.Constants
  5. Imports Microsoft.Office.Interop.Excel.XlBordersIndex
  6. Imports Microsoft.Office.Interop.Excel.XlLineStyle
  7. Imports Microsoft.Office.Interop.Excel.XlBorderWeight
  8. Imports Microsoft.Office.Interop.Excel.XlThemeFont
  9. Imports Microsoft.Office.Interop.Excel.XlThemeColor
  10. Imports Microsoft.Office.Interop.Excel.XlWindowState
  11. Public Class 列印_預告訂單
  12. Private ReadOnly ds, ds1, ds2, ds3 As New DataSet
  13. Dim N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, N11, Q1 As Integer
  14. Dim xlApp As Microsoft.Office.Interop.Excel.Application
  15. Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
  16. Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
  17. Dim ww1, ww2 As Boolean
  18. Private Sub Set_清單()
  19. DataGridView1.DataSource = Nothing : ds.Clear()
  20. DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  21. DataGridView1.ColumnHeadersHeight = 25
  22. DataGridView1.AllowUserToAddRows = False
  23. ConnOpen()
  24. SQL1 = "SELECT PAO, SO, 季節, 客戶, BUYER, 工廠, 型體號碼, 型體名稱, 總數量, ETD, ISSUE_DATE, FOB, ConstructionName, PS, 制單人, 制單時間, 版次 FROM 預告訂單控制表 " &
  25. "WHERE PAO LIKE N'" & 列印用SQL & "' AND 版次 LIKE N'" & 列印用SQL2 & "' ORDER BY SO DESC, 版次 DESC"
  26. CmdSet_For_DGV()
  27. da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
  28. End Sub
  29. Private Sub Set_清單2()
  30. DataGridView2.DataSource = Nothing : ds1.Clear()
  31. DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  32. DataGridView2.ColumnHeadersHeight = 25
  33. DataGridView2.AllowUserToAddRows = False
  34. ConnOpen()
  35. SQL1 = "SELECT 項次, 顏色, 雙數, SPLS, BUYING, SELLING, 流水號, 版次, 備註 FROM 預告訂單清單 WHERE (PAO LIKE N'" & 列印用SQL & "' AND 版次 LIKE N'" & 列印用SQL2 & "') ORDER BY 項次"
  36. CmdSet_For_DGV()
  37. da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
  38. End Sub
  39. Private Sub Set_清單3()
  40. DataGridView3.DataSource = Nothing : ds2.Clear()
  41. DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  42. DataGridView3.ColumnHeadersHeight = 25
  43. DataGridView3.AllowUserToAddRows = False
  44. ConnOpen()
  45. SQL1 = "SELECT LEFT(預告訂單部件表.部件, 2) AS 部件, 部件大項分類.部件類別 FROM 預告訂單部件表 LEFT OUTER JOIN 部件大項分類 ON LEFT(預告訂單部件表.部件, 2) = LEFT(部件大項分類.部件類別, 2) " &
  46. "WHERE (預告訂單部件表.PAO LIKE N'" & 列印用SQL & "') AND (預告訂單部件表.版次 LIKE N'" & 列印用SQL2 & "') GROUP BY LEFT(預告訂單部件表.部件, 2), 部件大項分類.部件類別 ORDER BY 部件"
  47. CmdSet_For_DGV()
  48. da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close()
  49. End Sub
  50. Private Sub Set_格式設定()
  51. DataGridView1.Visible = False : DataGridView2.Visible = False : DataGridView3.Visible = False : DataGridView4.Visible = False : PictureBox1.Visible = False
  52. End Sub
  53. Private Sub 列印_預告訂單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  54. FormBorderStyle = FormBorderStyle.SizableToolWindow : ControlBox = False
  55. CheckBox1.Checked = True : CheckBox2.Checked = False : CheckBox3.Checked = False
  56. CheckBox4.Checked = True : CheckBox5.Checked = False : CheckBox6.Checked = False
  57. Set_清單() : Set_清單2() : Set_清單3() : Set_格式設定()
  58. End Sub
  59. Private Sub 列印1()
  60. xlSheet.Cells(1, 1) = "WTL ENTERPRISE CO., LTD." : xlSheet.Cells(1, 21) = "PAO(預告訂單)" : xlSheet.Cells(2, 1) = "11F-9., No.151, Sec. 2, Hankou Rd., Situn Dist., "
  61. xlSheet.Cells(3, 1) = "Taichung City, Taiwan 40746" : xlSheet.Cells(3, 24) = "PRINT DATE :" : xlSheet.Cells(3, 29) = "=TODAY()" : xlSheet.Cells(5, 1) = "PAO # (單號)"
  62. xlSheet.Cells(6, 1) = "CUST (客戶)" : xlSheet.Cells(7, 1) = "FACTORY (工廠)" : xlSheet.Cells(8, 1) = "STYLE # (型體號)" : xlSheet.Cells(9, 1) = "STY.NAME (型體名)"
  63. xlSheet.Cells(10, 1) = "FOB (港口)" : xlSheet.Cells(11, 1) = "BUYER (買方)" : xlSheet.Cells(12, 1) = "PS (備註)"
  64. xlSheet.Cells(5, 6) = ":" : xlSheet.Cells(6, 6) = ":" : xlSheet.Cells(7, 6) = ":" : xlSheet.Cells(8, 6) = ":" : xlSheet.Cells(9, 6) = ":" : xlSheet.Cells(10, 6) = ":" : xlSheet.Cells(11, 6) = ":"
  65. xlSheet.Cells(12, 6) = ":"
  66. xlSheet.Cells(5, 14) = "EDITION (版次)" : xlSheet.Cells(6, 14) = "SEASON (季節)" : xlSheet.Cells(7, 14) = "ISSUE. DATE (制單日期)" : xlSheet.Cells(8, 14) = "ETD (預計寄出日期)"
  67. xlSheet.Cells(9, 14) = "SO#(對應樣品單號)" : xlSheet.Cells(10, 14) = "ConstructionName" : xlSheet.Cells(11, 14) = "Q'TY (總數)"
  68. xlSheet.Cells(5, 19) = ":" : xlSheet.Cells(6, 19) = ":" : xlSheet.Cells(7, 19) = ":" : xlSheet.Cells(8, 19) = ":" : xlSheet.Cells(9, 19) = ":" : xlSheet.Cells(10, 19) = ":"
  69. xlSheet.Cells(11, 19) = ":"
  70. xlSheet.Cells(5, 7) = DataGridView1.Rows(0).Cells("PAO").Value : xlSheet.Cells(6, 7) = DataGridView1.Rows(0).Cells("客戶").Value
  71. xlSheet.Cells(7, 7) = DataGridView1.Rows(0).Cells("工廠").Value : xlSheet.Cells(8, 7) = DataGridView1.Rows(0).Cells("型體號碼").Value
  72. xlSheet.Cells(9, 7) = DataGridView1.Rows(0).Cells("型體名稱").Value : xlSheet.Cells(10, 7) = DataGridView1.Rows(0).Cells("FOB").Value
  73. xlSheet.Cells(11, 7) = DataGridView1.Rows(0).Cells("BUYER").Value : xlSheet.Cells(5, 20) = DataGridView1.Rows(0).Cells("版次").Value
  74. xlSheet.Cells(6, 20) = DataGridView1.Rows(0).Cells("季節").Value : xlSheet.Cells(7, 20) = DataGridView1.Rows(0).Cells("ISSUE_DATE").Value
  75. xlSheet.Cells(8, 20) = DataGridView1.Rows(0).Cells("ETD").Value : xlSheet.Cells(9, 20) = DataGridView1.Rows(0).Cells("SO").Value
  76. xlSheet.Cells(10, 20) = "" : xlSheet.Cells(11, 20) = DataGridView1.Rows(0).Cells("總數量").Value
  77. xlSheet.Cells(12, 7) = DataGridView1.Rows(0).Cells("PS").Value
  78. AA(xlApp, xlSheet)
  79. PictureBox1.Image = Nothing
  80. ConnOpen()
  81. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  82. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  83. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 類別 LIKE N'設計圖'"
  84. CmdSet_For_dr()
  85. If dr.Read() Then
  86. PictureBox1.Image = Nothing
  87. ConnOpen()
  88. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  89. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  90. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 類別 LIKE N'設計圖'"
  91. CmdSet_For_dr()
  92. While dr.Read() = True
  93. Dim bytes As Byte() = New Byte(-1) {}
  94. bytes = DirectCast(dr.Item("圖片"), Byte())
  95. Dim oStream As New MemoryStream(bytes)
  96. PictureBox1.Image = Image.FromStream(oStream)
  97. End While
  98. conn.Close() : GG(xlApp, xlSheet)
  99. Else
  100. xlSheet.Cells(5, 28) = "系統中無圖片"
  101. conn.Close()
  102. End If : PictureBox1.SizeMode = 4
  103. N1 = 0 : N2 = 0 : N4 = 0 : N5 = 0 : N6 = -1 : N7 = -1 : N8 = 0
  104. End Sub
  105. Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
  106. If CheckBox1.Checked = False And CheckBox2.Checked = False And CheckBox3.Checked = False Then
  107. MsgBox("沒有選擇顏色分配頁數")
  108. Else
  109. xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
  110. xlBook = xlApp.Workbooks.Add
  111. xlApp.DisplayAlerts = True
  112. xlApp.Visible = True
  113. xlApp.Application.WindowState = xlMaximized
  114. For i As Integer = 0 To DataGridView2.Rows.Count - 1
  115. If CheckBox1.Checked = True Then
  116. '三色一頁
  117. If i = 0 Then
  118. xlSheet = NewMethod(xlBook)
  119. If xlApp.Sheets(1).Name = "工作表2" Then
  120. xlApp.Sheets("工作表2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  121. Else
  122. xlApp.Sheets("sheet2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  123. End If
  124. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  125. ElseIf i = 3 Then
  126. FF(xlApp, xlSheet)
  127. xlSheet = NewMethod(xlBook)
  128. If xlApp.Sheets(1).Name = "工作表3" Then
  129. xlApp.Sheets("工作表3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  130. Else
  131. xlApp.Sheets("sheet3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  132. End If
  133. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  134. ElseIf i = 6 Then
  135. FF(xlApp, xlSheet)
  136. xlSheet = NewMethod(xlBook)
  137. If xlApp.Sheets(1).Name = "工作表4" Then
  138. xlApp.Sheets("工作表4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  139. Else
  140. xlApp.Sheets("sheet4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  141. End If
  142. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  143. ElseIf i = 9 Then
  144. FF(xlApp, xlSheet)
  145. xlSheet = NewMethod(xlBook)
  146. If xlApp.Sheets(1).Name = "工作表5" Then
  147. xlApp.Sheets("工作表5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  148. Else
  149. xlApp.Sheets("sheet5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  150. End If
  151. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  152. End If
  153. ElseIf CheckBox3.Checked = True Then
  154. '四色一頁
  155. If i = 0 Then
  156. xlSheet = NewMethod(xlBook)
  157. If xlApp.Sheets(1).Name = "工作表2" Then
  158. xlApp.Sheets("工作表2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  159. Else
  160. xlApp.Sheets("sheet2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  161. End If
  162. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  163. ElseIf i = 4 Then
  164. FF(xlApp, xlSheet)
  165. xlSheet = NewMethod(xlBook)
  166. If xlApp.Sheets(1).Name = "工作表3" Then
  167. xlApp.Sheets("工作表3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  168. Else
  169. xlApp.Sheets("sheet3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  170. End If
  171. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  172. ElseIf i = 8 Then
  173. FF(xlApp, xlSheet)
  174. xlSheet = NewMethod(xlBook)
  175. If xlApp.Sheets(1).Name = "工作表4" Then
  176. xlApp.Sheets("工作表4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  177. Else
  178. xlApp.Sheets("sheet4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  179. End If
  180. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  181. End If
  182. ElseIf CheckBox2.Checked = True Then
  183. '二色一頁
  184. If i = 0 Then
  185. xlSheet = NewMethod(xlBook)
  186. If xlApp.Sheets(1).Name = "工作表2" Then
  187. xlApp.Sheets("工作表2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  188. Else
  189. xlApp.Sheets("sheet2").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第一頁"
  190. End If
  191. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  192. ElseIf i = 2 Then
  193. FF(xlApp, xlSheet)
  194. xlSheet = NewMethod(xlBook)
  195. If xlApp.Sheets(1).Name = "工作表3" Then
  196. xlApp.Sheets("工作表3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  197. Else
  198. xlApp.Sheets("sheet3").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第二頁"
  199. End If
  200. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  201. ElseIf i = 4 Then
  202. FF(xlApp, xlSheet)
  203. xlSheet = NewMethod(xlBook)
  204. If xlApp.Sheets(1).Name = "工作表4" Then
  205. xlApp.Sheets("工作表4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  206. Else
  207. xlApp.Sheets("sheet4").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第三頁"
  208. End If
  209. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  210. ElseIf i = 6 Then
  211. FF(xlApp, xlSheet)
  212. xlSheet = NewMethod(xlBook)
  213. If xlApp.Sheets(1).Name = "工作表5" Then
  214. xlApp.Sheets("工作表5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  215. Else
  216. xlApp.Sheets("sheet5").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第四頁"
  217. End If
  218. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  219. ElseIf i = 8 Then
  220. FF(xlApp, xlSheet)
  221. xlSheet = NewMethod(xlBook)
  222. If xlApp.Sheets(1).Name = "工作表6" Then
  223. xlApp.Sheets("工作表6").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第五頁"
  224. Else
  225. xlApp.Sheets("sheet6").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第五頁"
  226. End If
  227. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  228. ElseIf i = 10 Then
  229. FF(xlApp, xlSheet)
  230. xlSheet = NewMethod(xlBook)
  231. If xlApp.Sheets(1).Name = "工作表7" Then
  232. xlApp.Sheets("工作表7").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第六頁"
  233. Else
  234. xlApp.Sheets("sheet7").Name = DataGridView1.Rows(0).Cells("型體名稱").Value & "第六頁"
  235. End If
  236. xlBook.Activate() : xlSheet.Activate() : 列印1() : Q1 = 0
  237. End If
  238. End If
  239. N6 += 1 : N7 += 1 : N9 = Q1 + N2 + N4 + N5
  240. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 1) = "#" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 2) = "COLOR (顏色)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 8) = "PRS (雙數)"
  241. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 11) = "SPLS"
  242. If CheckBox4.Checked = True Then
  243. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 14) = "BUYING" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 17) = "SELLING"
  244. ElseIf CheckBox5.Checked = True Then
  245. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 14) = "BUYING"
  246. ElseIf CheckBox6.Checked = True Then
  247. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 14) = "SELLING"
  248. End If
  249. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 1) = DataGridView2.Rows(i).Cells("項次").Value : xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 2) = DataGridView2.Rows(i).Cells("顏色").Value
  250. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 8) = DataGridView2.Rows(i).Cells("雙數").Value : xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 11) = DataGridView2.Rows(i).Cells("SPLS").Value
  251. If CheckBox4.Checked = True Then
  252. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 14) = DataGridView2.Rows(i).Cells("BUYING").Value : xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 17) = DataGridView2.Rows(i).Cells("SELLING").Value
  253. ElseIf CheckBox5.Checked = True Then
  254. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 14) = DataGridView2.Rows(i).Cells("BUYING").Value
  255. ElseIf CheckBox6.Checked = True Then
  256. xlSheet.Cells(Q1 + N2 + N4 + N5 + 15, 14) = DataGridView2.Rows(i).Cells("SELLING").Value
  257. End If
  258. xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 1) = "#" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 2) = "DESCRIPTION (部件說明)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 8) = "MATERIALS (材料名稱)"
  259. xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 14) = "COLOR (顏色)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 20) = "SUPPLIER (廠商)" : xlSheet.Cells(Q1 + N2 + N4 + N5 + 16, 24) = "REMARKS (備註)"
  260. BB(xlApp, xlSheet)
  261. PictureBox1.Image = Nothing
  262. ConnOpen()
  263. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  264. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  265. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 顏色 LIKE N'" & DataGridView2.Rows(i).Cells("顏色").Value & "'"
  266. CmdSet_For_dr()
  267. If dr.Read() Then
  268. PictureBox1.Image = Nothing
  269. ConnOpen()
  270. SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
  271. "WHERE 客戶 LIKE N'" & DataGridView1.Rows(0).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(0).Cells("型體號碼").Value &
  272. "' AND 形體名 LIKE N'" & DataGridView1.Rows(0).Cells("型體名稱").Value & "' AND 顏色 LIKE N'" & DataGridView2.Rows(i).Cells("顏色").Value & "'"
  273. CmdSet_For_dr()
  274. While dr.Read() = True
  275. Dim bytes As Byte() = New Byte(-1) {} : bytes = DirectCast(dr.Item("圖片"), Byte()) : Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  276. End While
  277. conn.Close() : HH(xlApp, xlSheet)
  278. Else
  279. xlSheet.Cells(Q1 + N2 + N4 + N5 + 14, 28) = "系統中無圖片"
  280. conn.Close()
  281. End If : PictureBox1.SizeMode = 4
  282. N3 = 0 ':
  283. For ii As Integer = 0 To DataGridView3.Rows.Count - 1
  284. xlSheet.Cells(ii + N2 + N4 + N5 + 17 + N6, 2) = DataGridView3.Rows(ii).Cells("部件類別").Value
  285. N10 = ii + N2 + N4 + N5 + N6 : CC(xlApp, xlSheet)
  286. DataGridView4.DataSource = Nothing : ds3.Clear()
  287. DataGridView4.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  288. DataGridView4.ColumnHeadersHeight = 25
  289. DataGridView4.AllowUserToAddRows = False
  290. ConnOpen()
  291. SQL1 = "SELECT PAO, 項次, 部件, 材料名稱, 材料說明, 備註, 廠商, 版次, 流水號 FROM 預告訂單部件表 " &
  292. "WHERE (PAO LIKE N'" & 列印用SQL & "') AND (版次 LIKE N'" & 列印用SQL2 & "') AND (流水號 LIKE N'" & DataGridView2.Rows(i).Cells("流水號").Value & "') " &
  293. "AND (部件 LIKE N'" & DataGridView3.Rows(ii).Cells("部件").Value & "%') ORDER BY 項次, 部件"
  294. CmdSet_For_DGV()
  295. da.Fill(ds3) : DataGridView4.DataSource = ds3.Tables(0) : conn.Close()
  296. For iii As Integer = 0 To DataGridView4.Rows.Count - 1
  297. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 1) = DataGridView2.Rows(i).Cells("項次").Value
  298. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 2) = DataGridView4.Rows(iii).Cells("部件").Value
  299. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 8) = DataGridView4.Rows(iii).Cells("材料名稱").Value
  300. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 14) = DataGridView4.Rows(iii).Cells("材料說明").Value
  301. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 20) = DataGridView4.Rows(iii).Cells("廠商").Value
  302. xlSheet.Cells(iii + N2 + N3 + N8 + N5 + N6 + N7 + 18, 24) = DataGridView4.Rows(iii).Cells("備註").Value
  303. If Len(DataGridView4.Rows(iii).Cells("材料名稱").Value) > 45 Then
  304. ww1 = True
  305. Else
  306. ww1 = False
  307. End If
  308. If Len(DataGridView4.Rows(iii).Cells("備註").Value) > 25 Then
  309. ww2 = True
  310. Else
  311. ww2 = False
  312. End If
  313. N1 = iii + 1 : N11 = iii + N2 + N3 + N8 + N5 + N6 + N7 : DD(xlApp, xlSheet)
  314. Next iii
  315. N2 += N1 : N3 = ii + 1
  316. Next ii
  317. N4 = N4 + N3 + 1 : N8 += N3
  318. With xlApp.Selection : .Font.Bold = True : End With
  319. N5 += 2 : EE(xlApp, xlSheet) : Q1 += 1
  320. Next i
  321. FF(xlApp, xlSheet)
  322. xlSheet.PageSetup.PrintArea = ""
  323. xlApp.Cells.Select()
  324. xlSheet.Range("B1").Select()
  325. xlApp.Application.WindowState = xlMinimized
  326. MsgBox("列印完成")
  327. Me.Close()
  328. End If
  329. End Sub
  330. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  331. 列印用SQL = "" : Me.Close()
  332. End Sub
  333. Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet
  334. Return CType(xlBook.Worksheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
  335. End Function
  336. Private Sub AA(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  337. xlSheet.Cells.Select()
  338. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  339. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  340. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 3
  341. xlSheet.Columns("B:G").Select : myExcel.Selection.ColumnWidth = 4
  342. xlSheet.Columns("H:M").Select : myExcel.Selection.ColumnWidth = 8
  343. xlSheet.Columns("N:AH").Select : myExcel.Selection.ColumnWidth = 3
  344. xlSheet.Range("A1").Select()
  345. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 26 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  346. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  347. xlSheet.Range("U1").Select()
  348. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  349. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  350. xlSheet.Range("A2").Select()
  351. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  352. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  353. xlSheet.Range("A3").Select()
  354. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 14 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  355. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  356. xlSheet.Range("A3:AH3").Select()
  357. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  358. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  359. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  360. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  361. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  362. xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 3
  363. xlSheet.Range("G5:M5").Select() : myExcel.Selection.Merge
  364. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  365. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  366. xlSheet.Range("G6:M6").Select() : myExcel.Selection.Merge
  367. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  368. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  369. xlSheet.Range("G7:M7").Select() : myExcel.Selection.Merge
  370. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  371. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  372. xlSheet.Range("G8:M8").Select() : myExcel.Selection.Merge
  373. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  374. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  375. xlSheet.Range("G9:M9").Select() : myExcel.Selection.Merge
  376. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  377. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  378. xlSheet.Range("G10:M10").Select() : myExcel.Selection.Merge
  379. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  380. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  381. xlSheet.Range("G11:M11").Select() : myExcel.Selection.Merge
  382. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  383. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  384. xlSheet.Range("T5:Z5").Select() : myExcel.Selection.Merge
  385. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  386. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  387. xlSheet.Range("T6:Z6").Select() : myExcel.Selection.Merge
  388. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  389. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  390. xlSheet.Range("T7:Z7").Select() : myExcel.Selection.Merge
  391. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  392. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  393. xlSheet.Range("T8:Z8").Select() : myExcel.Selection.Merge
  394. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  395. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  396. xlSheet.Range("T9:Z9").Select() : myExcel.Selection.Merge
  397. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  398. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  399. xlSheet.Range("T10:Z10").Select() : myExcel.Selection.Merge
  400. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  401. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  402. xlSheet.Range("T11:Z11").Select() : myExcel.Selection.Merge
  403. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  404. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  405. xlSheet.Range("AA3:AC3").Select() : myExcel.Selection.Merge
  406. xlSheet.Range("AB5:AH12").Select() : myExcel.Selection.Merge
  407. xlSheet.Columns("A:A").Select : myExcel.Selection.NumberFormatLocal = "@"
  408. myExcel.ActiveWindow.DisplayGridlines = False
  409. xlSheet.Range("G12:AA12").Select() : myExcel.Selection.Merge
  410. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
  411. .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  412. xlSheet.Range("A12:AH12").Select()
  413. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  414. myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
  415. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  416. myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
  417. myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  418. End Sub
  419. Private Sub BB(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  420. Dim 位置1 As String
  421. 位置1 = 13 + N9 & ":" & 13 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 3
  422. 位置1 = 14 + N9 & ":" & 14 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 30
  423. 位置1 = 15 + N9 & ":" & 15 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 30
  424. 位置1 = 16 + N9 & ":" & 16 + N9 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 15
  425. If CheckBox4.Checked = True Then
  426. 位置1 = "A" & 14 + N9 & ":S" & 14 + N9 : xlSheet.Range(位置1).Select()
  427. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent2
  428. .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  429. Else
  430. 位置1 = "A" & 14 + N9 & ":P" & 14 + N9 : xlSheet.Range(位置1).Select()
  431. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent2
  432. .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  433. End If
  434. 位置1 = "A" & 16 + N9 & ":AH" & 16 + N9 : xlSheet.Range(位置1).Select()
  435. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent2 : .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  436. 位置1 = "A" & 14 + N9 & ":A" & 16 + N9 : xlSheet.Range(位置1).Select()
  437. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  438. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  439. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  440. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  441. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  442. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  443. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  444. 位置1 = "B" & 14 + N9 & ":G" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  445. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  446. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  447. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  448. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  449. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  450. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  451. 位置1 = "B" & 15 + N9 & ":G" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  452. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  453. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  454. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  455. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  456. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  457. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  458. 位置1 = "H" & 14 + N9 & ":J" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  459. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  460. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  461. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  462. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  463. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  464. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  465. 位置1 = "H" & 15 + N9 & ":J" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  466. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  467. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  468. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  469. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  470. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  471. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  472. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  473. 位置1 = "K" & 14 + N9 & ":M" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  474. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  475. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  476. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  477. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  478. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  479. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  480. 位置1 = "K" & 15 + N9 & ":M" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  481. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  482. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  483. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  484. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  485. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  486. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  487. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  488. 位置1 = "N" & 14 + N9 & ":P" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  489. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  490. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  491. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  492. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  493. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  494. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  495. 位置1 = "N" & 15 + N9 & ":P" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  496. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  497. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  498. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  499. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  500. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  501. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  502. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  503. If CheckBox4.Checked = True Then
  504. 位置1 = "Q" & 14 + N9 & ":S" & 14 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  505. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  506. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  507. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  508. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  509. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  510. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  511. 位置1 = "Q" & 15 + N9 & ":S" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  512. myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0.0_-;-* #,##0.0_-;_-* ""-""??_-;_-@_-"
  513. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  514. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  515. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  516. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  517. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  518. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  519. End If
  520. 位置1 = "AB" & 14 + N9 & ":AH" & 15 + N9 : xlSheet.Range(位置1).Select()
  521. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  522. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  523. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  524. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  525. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  526. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  527. 位置1 = "B" & 16 + N9 & ":G" & 16 + N9 : xlSheet.Range(位置1).Select()
  528. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  529. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  530. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  531. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  532. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  533. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  534. 位置1 = "H" & 16 + N9 & ":M" & 16 + N9 : xlSheet.Range(位置1).Select()
  535. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  536. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  537. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  538. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  539. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  540. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  541. 位置1 = "N" & 16 + N9 & ":S" & 16 + N9 : xlSheet.Range(位置1).Select()
  542. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  543. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  544. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  545. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  546. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  547. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  548. 位置1 = "T" & 16 + N9 & ":W" & 16 + N9 : xlSheet.Range(位置1).Select()
  549. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  550. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  551. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  552. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  553. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  554. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  555. 位置1 = "X" & 16 + N9 & ":AH" & 16 + N9 : xlSheet.Range(位置1).Select()
  556. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  557. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  558. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  559. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  560. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  561. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  562. 位置1 = "AB" & 14 + N9 & ":AH" & 15 + N9 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  563. End Sub
  564. Private Sub CC(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  565. Dim 位置1 As String
  566. 位置1 = 17 + N10 & ":" & 17 + N10 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 15
  567. 位置1 = "A" & 17 + N10 & ":AH" & 17 + N10 : xlSheet.Range(位置1).Select()
  568. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  569. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  570. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  571. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  572. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  573. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  574. 位置1 = "B" & 17 + N10 & ":G" & 17 + N10 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  575. With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent6 : .TintAndShade = 0.799981688894314 : .PatternTintAndShade = 0 : End With
  576. End Sub
  577. Private Sub DD(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  578. Dim 位置1 As String
  579. 位置1 = "A" & 18 + N11 : xlSheet.Range(位置1).Select()
  580. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  581. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  582. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  583. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  584. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  585. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  586. 位置1 = "B" & 18 + N11 & ":G" & 18 + N11 : xlSheet.Range(位置1).Select()
  587. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  588. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  589. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  590. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  591. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  592. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  593. 位置1 = "H" & 18 + N11 & ":M" & 18 + N11 : xlSheet.Range(位置1).Select()
  594. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  595. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  596. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  597. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  598. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  599. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  600. 位置1 = "N" & 18 + N11 & ":S" & 18 + N11 : xlSheet.Range(位置1).Select()
  601. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  602. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  603. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  604. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  605. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  606. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  607. 位置1 = "T" & 18 + N11 & ":W" & 18 + N11 : xlSheet.Range(位置1).Select()
  608. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  609. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  610. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  611. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  612. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  613. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  614. 位置1 = "X" & 18 + N11 & ":AH" & 18 + N11 : xlSheet.Range(位置1).Select()
  615. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  616. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  617. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  618. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlHairline : End With
  619. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  620. myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  621. 位置1 = "B" & 18 + N11 & ":G" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  622. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  623. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  624. 位置1 = "H" & 18 + N11 & ":M" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  625. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  626. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  627. 位置1 = "N" & 18 + N11 & ":S" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  628. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  629. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  630. 位置1 = "T" & 18 + N11 & ":W" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  631. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  632. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  633. 位置1 = "X" & 18 + N11 & ":AH" & 18 + N11 : xlSheet.Range(位置1).Select() : myExcel.Selection.Merge
  634. With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
  635. .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
  636. 位置1 = 18 + N11 & ":" & 18 + N11 : xlSheet.Rows(位置1).Select
  637. With myExcel.Selection : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : End With
  638. If ww1 = False And ww2 = False Then
  639. 位置1 = 18 + N11 & ":" & 18 + N11 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 15
  640. Else
  641. 位置1 = 18 + N11 & ":" & 18 + N11 : xlSheet.Rows(位置1).Select : myExcel.Selection.RowHeight = 30
  642. End If
  643. End Sub
  644. Private Sub EE(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  645. Dim 位置1 As String
  646. 位置1 = "A" & 14 + N9 & ":AH" & 18 + N11 : xlSheet.Range(位置1).Select()
  647. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  648. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  649. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  650. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  651. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
  652. End Sub
  653. Private Sub FF(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  654. xlSheet.Columns("A:AH").Select
  655. myExcel.ActiveSheet.PageSetup.PrintArea = "$A:$AH"
  656. myExcel.Application.PrintCommunication = False
  657. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$12" : .PrintTitleColumns = "" : End With
  658. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "$A:$AH" : myExcel.Application.PrintCommunication = False
  659. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  660. .LeftMargin = myExcel.Application.InchesToPoints(0.196850393700787) : .RightMargin = myExcel.Application.InchesToPoints(0.196850393700787)
  661. .TopMargin = myExcel.Application.InchesToPoints(0.393700787401575) : .BottomMargin = myExcel.Application.InchesToPoints(0.196850393700787)
  662. .HeaderMargin = myExcel.Application.InchesToPoints(0) : .FooterMargin = myExcel.Application.InchesToPoints(0)
  663. .PrintHeadings = False : .PrintGridlines = False : .PrintQuality = 600 : .CenterHorizontally = True : .CenterVertically = False : .Draft = False
  664. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = 0 : .OddAndEvenPagesHeaderFooter = False
  665. .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = ""
  666. .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = ""
  667. .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = ""
  668. .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  669. End With
  670. myExcel.Application.PrintCommunication = True
  671. End Sub
  672. Private Sub GG(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  673. Dim 位置1 As String
  674. Clipboard.SetDataObject(PictureBox1.Image)
  675. 位置1 = "AB5" : xlSheet.Range(位置1).Select()
  676. myExcel.ActiveSheet.Pictures.Paste.Select
  677. myExcel.Selection.ShapeRange.Height = 79
  678. End Sub
  679. Private Sub HH(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  680. Dim 位置1 As String
  681. Clipboard.SetDataObject(PictureBox1.Image)
  682. 位置1 = "AB" & N9 + 14 : xlSheet.Range(位置1).Select()
  683. myExcel.ActiveSheet.Pictures.Paste.Select
  684. myExcel.Selection.ShapeRange.Height = 59
  685. End Sub
  686. Private Sub CheckBox3_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox3.Click
  687. CheckBox3.Checked = True : CheckBox1.Checked = False : CheckBox2.Checked = False
  688. End Sub
  689. Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.Click
  690. CheckBox3.Checked = False : CheckBox1.Checked = True : CheckBox2.Checked = False
  691. End Sub
  692. Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.Click
  693. CheckBox3.Checked = False : CheckBox1.Checked = False : CheckBox2.Checked = True
  694. End Sub
  695. Private Sub CheckBox4_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox4.Click
  696. CheckBox4.Checked = True : CheckBox5.Checked = False : CheckBox6.Checked = False
  697. End Sub
  698. Private Sub CheckBox5_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox5.Click
  699. CheckBox4.Checked = False : CheckBox5.Checked = True : CheckBox6.Checked = False
  700. End Sub
  701. Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox6.Click
  702. CheckBox4.Checked = False : CheckBox5.Checked = False : CheckBox6.Checked = True
  703. End Sub
  704. End Class