No Description
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 66KB

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