Bez popisu
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 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. Imports Microsoft.Office.Interop.Excel
  12. Public Class 試穿_訂料授權書
  13. Private ReadOnly ds, ds1, ds2 As New DataSet
  14. Dim N1 As Integer
  15. Dim 位置1 As String
  16. Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
  17. Private Sub Set_清單()
  18. 主表單_dgv.DataSource = Nothing : ds.Clear()
  19. 主表單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  20. 主表單_dgv.ColumnHeadersHeight = 25
  21. 主表單_dgv.AllowUserToAddRows = False
  22. 主表單_dgv.RowTemplate.Height = 50
  23. SQL_預告訂單控制表單()
  24. da.Fill(ds) : 主表單_dgv.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
  25. End Sub
  26. Private Sub Set_grid()
  27. Dim YY As Integer = 主表單_dgv.Size.Height
  28. If 清單伸展_ch.Checked = False Then
  29. 主表單_dgv.Size = New Size(475, YY)
  30. 主表單_dgv.Columns(0).Width = 85 : 主表單_dgv.Columns(1).Width = 55 : 主表單_dgv.Columns(2).Width = 65 : 主表單_dgv.Columns(3).Width = 100 : 主表單_dgv.Columns(6).Width = 100
  31. 主表單_dgv.Columns(7).Visible = False
  32. Else
  33. 主表單_dgv.Size = New Size(745, YY)
  34. 主表單_dgv.Columns(0).Width = 85 : 主表單_dgv.Columns(1).Width = 55 : 主表單_dgv.Columns(2).Width = 65 : 主表單_dgv.Columns(3).Width = 170 : 主表單_dgv.Columns(6).Width = 150
  35. 主表單_dgv.Columns(7).Visible = True : 主表單_dgv.Columns(7).Width = 150
  36. End If
  37. 主表單_dgv.Columns(4).Visible = False : 主表單_dgv.Columns(5).Visible = False : 主表單_dgv.Columns(8).Visible = False
  38. 主表單_dgv.Columns(9).Visible = False : 主表單_dgv.Columns(10).Visible = False : 主表單_dgv.Columns(11).Visible = False : 主表單_dgv.Columns(12).Visible = False
  39. 主表單_dgv.Columns(13).Visible = False : 主表單_dgv.Columns(14).Visible = False : 主表單_dgv.Columns(15).Visible = False : 主表單_dgv.Columns(16).Width = 45
  40. End Sub
  41. Private Sub Set_清單1()
  42. 明細1_dgv.DataSource = Nothing : ds1.Clear()
  43. 明細1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  44. 明細1_dgv.ColumnHeadersHeight = 40
  45. 明細1_dgv.AllowUserToAddRows = False
  46. 明細1_dgv.RowTemplate.Height = 150
  47. SQL_明細1()
  48. da.Fill(ds1) : 明細1_dgv.DataSource = ds1.Tables(0) : conn.Close()
  49. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  50. If IsDBNull(明細1_dgv.Rows(i).Cells("FITTING COMMENTS").Value) Then : 明細1_dgv.Rows(i).Cells("FITTING COMMENTS").Value = " " : End If
  51. If IsDBNull(明細1_dgv.Rows(i).Cells("MATERAL COMMENTS").Value) Then : 明細1_dgv.Rows(i).Cells("MATERAL COMMENTS").Value = " " : End If
  52. If IsDBNull(明細1_dgv.Rows(i).Cells("FITTING回簽確認").Value) Then : 明細1_dgv.Rows(i).Cells("FITTING回簽確認").Value = " " : End If
  53. If IsDBNull(明細1_dgv.Rows(i).Cells("FITTING回簽日期").Value) Then : 明細1_dgv.Rows(i).Cells("FITTING回簽日期").Value = " " : End If
  54. If IsDBNull(明細1_dgv.Rows(i).Cells("MATERAIL回簽確認").Value) Then : 明細1_dgv.Rows(i).Cells("MATERAIL回簽確認").Value = " " : End If
  55. If IsDBNull(明細1_dgv.Rows(i).Cells("MATERAIL回簽日期").Value) Then : 明細1_dgv.Rows(i).Cells("MATERAIL回簽日期").Value = " " : End If
  56. Next
  57. 明細1_dgv.Columns(0).Visible = False : 明細1_dgv.Columns(1).Visible = False : 明細1_dgv.Columns(2).Visible = False : 明細1_dgv.Columns(3).Width = 100
  58. 明細1_dgv.Columns(4).Width = 100 : 明細1_dgv.Columns(5).Width = 100 : 明細1_dgv.Columns(6).Width = 275 : 明細1_dgv.Columns(7).Width = 80 : 明細1_dgv.Columns(8).Width = 80
  59. 明細1_dgv.Columns(9).Width = 125 : 明細1_dgv.Columns(10).Width = 125 : 明細1_dgv.Columns(11).Width = 100 : 明細1_dgv.Columns(12).Width = 100 : 明細1_dgv.Columns(13).Width = 100
  60. 明細1_dgv.Columns(14).Width = 100 : 明細1_dgv.Columns(15).Visible = False : 明細1_dgv.Columns(16).Visible = False
  61. 明細1_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  62. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  63. 資料數 = 明細1_dgv.Rows.Count : MyModule1.進度條()
  64. 明細1_dgv.Rows(i).Cells("MATERIAL_DESCRIPTION").Value = ""
  65. Dim aa As Integer = 1
  66. For ii As Integer = 0 To 明細2_dgv.Rows.Count - 1
  67. If 明細1_dgv.Rows(i).Cells("流水號").Value = 明細2_dgv.Rows(ii).Cells("流水號").Value Then
  68. If aa = 1 Then
  69. 明細1_dgv.Rows(i).Cells("MATERIAL_DESCRIPTION").Value = aa & "、" & 明細2_dgv.Rows(ii).Cells("材料名稱").Value & "-" & 明細2_dgv.Rows(ii).Cells("材料說明").Value
  70. aa += 1
  71. Else
  72. 明細1_dgv.Rows(i).Cells("MATERIAL_DESCRIPTION").Value = 明細1_dgv.Rows(i).Cells("MATERIAL_DESCRIPTION").Value & "
  73. " & aa & "、" & 明細2_dgv.Rows(ii).Cells("材料名稱").Value & "-" & 明細2_dgv.Rows(ii).Cells("材料說明").Value
  74. aa += 1
  75. End If
  76. End If
  77. Next
  78. Next : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  79. End Sub
  80. Private Sub Set_清單2()
  81. 明細2_dgv.DataSource = Nothing : ds2.Clear()
  82. 明細2_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  83. 明細2_dgv.ColumnHeadersHeight = 25
  84. 明細2_dgv.AllowUserToAddRows = False
  85. 明細2_dgv.RowTemplate.Height = 50
  86. SQL_明細2()
  87. da.Fill(ds2) : 明細2_dgv.DataSource = ds2.Tables(0) : conn.Close()
  88. End Sub
  89. Private Sub 試穿_定料授權書_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  90. WINPROFIT_ERP_SYS.WindowState = 2 : Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
  91. 明細2_dgv.Visible = False
  92. Set_清單()
  93. End Sub
  94. Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
  95. If 提醒_lb.Visible = True Then : 提醒_lb.Visible = False : Else : 提醒_lb.Visible = True : End If
  96. End Sub
  97. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 主表單_dgv.CellClick
  98. If e.RowIndex = -1 Then : Else
  99. 預告訂單單號_tb.Text = 主表單_dgv.Rows(e.RowIndex).Cells("PAO").Value : 版次_tb.Text = 主表單_dgv.Rows(e.RowIndex).Cells("版次").Value : Set_清單2() : Set_清單1()
  100. 客戶_tb.Text = 主表單_dgv.Rows(e.RowIndex).Cells("客戶").Value : Timer1.Enabled = False
  101. PictureBox2.Image = Nothing
  102. PA = 主表單_dgv.Rows(e.RowIndex).Cells("客戶").Value : PA1 = 主表單_dgv.Rows(e.RowIndex).Cells("型體號碼").Value
  103. SQL_鞋型圖片資料庫()
  104. While dr.Read() = True
  105. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  106. Dim oStream As New MemoryStream(bytes) : PictureBox2.Image = Bitmap.FromStream(oStream)
  107. End While
  108. conn.Close() : PictureBox2.SizeMode = 4 : PictureBox1.Image = Nothing
  109. End If
  110. End Sub
  111. Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 明細1_dgv.CellClick
  112. If e.RowIndex = -1 Then : Else
  113. Timer1.Enabled = True
  114. PictureBox1.Image = Nothing
  115. PA = 明細1_dgv.Rows(e.RowIndex).Cells("客戶").Value : PA1 = 明細1_dgv.Rows(e.RowIndex).Cells("型體號碼").Value
  116. PA2 = 明細1_dgv.Rows(e.RowIndex).Cells("STYLE_NAME").Value : PA3 = 明細1_dgv.Rows(e.RowIndex).Cells("COLOR").Value
  117. SQL_鞋型圖片資料庫1()
  118. If dr.Read() Then
  119. PictureBox1.Image = Nothing
  120. SQL_鞋型圖片資料庫1()
  121. While dr.Read() = True
  122. Dim unused1 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  123. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  124. End While
  125. conn.Close()
  126. Else
  127. PictureBox1.Image = Nothing
  128. PA4 = 明細1_dgv.Rows(e.RowIndex).Cells("客戶").Value : PA5 = 明細1_dgv.Rows(e.RowIndex).Cells("型體號碼").Value
  129. SQL_鞋型圖片資料庫2()
  130. If dr.Read() Then
  131. PictureBox1.Image = Nothing
  132. SQL_鞋型圖片資料庫2()
  133. While dr.Read() = True
  134. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  135. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  136. End While
  137. conn.Close()
  138. Else
  139. PictureBox1.Image = Nothing
  140. End If
  141. conn.Close()
  142. End If : PictureBox1.SizeMode = 4
  143. End If
  144. End Sub
  145. Private Sub Button9_Click(sender As Object, e As EventArgs) Handles 搜尋_bt.Click
  146. PA = InputBox("請輸入要查詢的關鍵字") : Set_清單() : PA = ""
  147. End Sub
  148. Private Sub Button32_Click(sender As Object, e As EventArgs) Handles 返回_bt.Click
  149. PA = "" : Set_清單()
  150. End Sub
  151. Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles 清單伸展_ch.Click
  152. Set_grid()
  153. End Sub
  154. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
  155. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  156. 資料數 = 明細1_dgv.Rows.Count : MyModule1.進度條()
  157. PA = 明細1_dgv.Rows(i).Cells("FITTING COMMENTS").Value : PA1 = 明細1_dgv.Rows(i).Cells("MATERAL COMMENTS").Value
  158. PA2 = 明細1_dgv.Rows(i).Cells("FITTING回簽確認").Value : PA3 = 明細1_dgv.Rows(i).Cells("FITTING回簽日期").Value
  159. PA4 = 明細1_dgv.Rows(i).Cells("MATERAIL回簽確認").Value : PA5 = 明細1_dgv.Rows(i).Cells("MATERAIL回簽日期").Value
  160. PA6 = 明細1_dgv.Rows(i).Cells("流水號").Value
  161. SQL_修改預告訂單清單() : conn.Close()
  162. Next : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
  163. Timer1.Enabled = False : Set_清單1() : MsgBox("存檔完成。")
  164. End Sub
  165. Private Sub Button2_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
  166. xlApp = CType(CreateObject("Excel.Application"), Application)
  167. xlBook = xlApp.Workbooks.Add
  168. xlApp.DisplayAlerts = True
  169. xlBook.Activate()
  170. xlSheet = NewMethod(xlBook)
  171. xlSheet.Activate()
  172. xlApp.Visible = True
  173. xlApp.Application.WindowState = xlMaximized
  174. xlSheet.Cells(1, 1) = "FIT MATERIAL AUTHORIZATION FORM" : xlSheet.Cells(2, 1) = 客戶_tb.Text : xlSheet.Cells(3, 1) = "DATE : " & Strings.Format(Today(), "yyyy/MM/dd")
  175. xlSheet.Cells(4, 1) = "PHOTO" : xlSheet.Cells(4, 2) = "BUYER" : xlSheet.Cells(4, 3) = "STYLE
  176. NAME"
  177. xlSheet.Cells(4, 4) = "COLOR" : xlSheet.Cells(4, 5) = " MATERIAL
  178. DESCRIPTION"
  179. xlSheet.Cells(4, 6) = "XF" : xlSheet.Cells(4, 7) = "REFERENCE
  180. SAMPLE"
  181. xlSheet.Cells(4, 8) = "FITTING
  182. COMMENTS"
  183. xlSheet.Cells(4, 9) = "MATERAL
  184. COMMENTS"
  185. N1 = 0
  186. For i As Integer = 0 To 明細1_dgv.Rows.Count - 1
  187. xlSheet.Cells(i + 5, 2) = 明細1_dgv.Rows(i).Cells("客戶").Value
  188. xlSheet.Cells(i + 5, 3) = 明細1_dgv.Rows(i).Cells("STYLE_NAME").Value
  189. xlSheet.Cells(i + 5, 4) = 明細1_dgv.Rows(i).Cells("COLOR").Value
  190. xlSheet.Cells(i + 5, 5) = 明細1_dgv.Rows(i).Cells("MATERIAL_DESCRIPTION").Value
  191. xlSheet.Cells(i + 5, 6) = 明細1_dgv.Rows(i).Cells("XF").Value
  192. xlSheet.Cells(i + 5, 7) = 明細1_dgv.Rows(i).Cells("REFERENCE SAMPL").Value
  193. xlSheet.Cells(i + 5, 8) = 明細1_dgv.Rows(i).Cells("FITTING COMMENTS").Value
  194. xlSheet.Cells(i + 5, 9) = 明細1_dgv.Rows(i).Cells("MATERAL COMMENTS").Value
  195. N1 = i + 5
  196. PictureBox1.Image = Nothing
  197. PA = 明細1_dgv.Rows(i).Cells("客戶").Value : PA1 = 明細1_dgv.Rows(i).Cells("型體號碼").Value
  198. PA2 = 明細1_dgv.Rows(i).Cells("STYLE_NAME").Value : PA3 = 明細1_dgv.Rows(i).Cells("COLOR").Value
  199. SQL_鞋型圖片資料庫3()
  200. If dr.Read() Then
  201. PictureBox1.Image = Nothing
  202. SQL_鞋型圖片資料庫3()
  203. While dr.Read() = True
  204. Dim unused1 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  205. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  206. End While
  207. conn.Close() : GG(xlApp, xlSheet)
  208. Else
  209. PictureBox1.Image = Nothing
  210. PA4 = 明細1_dgv.Rows(i).Cells("客戶").Value : PA5 = 明細1_dgv.Rows(i).Cells("型體號碼").Value
  211. SQL_鞋型圖片資料庫4()
  212. If dr.Read() Then
  213. PictureBox1.Image = Nothing
  214. SQL_鞋型圖片資料庫4()
  215. While dr.Read() = True
  216. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  217. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  218. End While
  219. conn.Close() : GG(xlApp, xlSheet)
  220. Else
  221. xlSheet.Cells(i + 5, 1) = "系統中無圖片"
  222. conn.Close()
  223. End If
  224. End If : PictureBox1.SizeMode = 4
  225. Next i
  226. BB(xlApp, xlSheet)
  227. xlSheet.PageSetup.PrintArea = ""
  228. xlApp.Cells.Select()
  229. xlSheet.Range("B1").Select()
  230. xlApp.Application.WindowState = xlMinimized
  231. MsgBox("列印完成")
  232. End Sub
  233. Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
  234. Return CType(xlBook.Worksheets.Add, Worksheet)
  235. End Function
  236. Private Sub BB(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
  237. xlSheet.Cells.Select()
  238. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  239. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  240. xlSheet.Rows("1:1").Select
  241. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 28 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  242. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  243. xlSheet.Rows("2:2").Select
  244. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  245. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  246. xlSheet.Rows("3:3").Select
  247. With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 16 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
  248. .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
  249. xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 12 : xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 15
  250. xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 12 : xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 15
  251. xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 60 : xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 12
  252. xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 15 : xlSheet.Columns("H:H").Select : myExcel.Selection.ColumnWidth = 20
  253. xlSheet.Columns("I:I").Select : myExcel.Selection.ColumnWidth = 20 : xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 40 : myExcel.Selection.Font.Bold = True
  254. For i As Integer = 5 To N1
  255. 'xlSheet.Rows(i & ":" & i).Select : myExcel.Rows(i & ":" & i).EntireRow.AutoFit
  256. xlSheet.Rows(i & ":" & i).Select : myExcel.Selection.RowHeight = 80
  257. Next
  258. xlSheet.Columns("F:F").Select
  259. With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
  260. .ReadingOrder = xlContext : .MergeCells = False : End With
  261. 位置1 = "A4:I" & N1 : xlSheet.Range(位置1).Select()
  262. myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
  263. With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  264. With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  265. With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  266. With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  267. With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  268. With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
  269. xlSheet.Rows("5:5").Select : myExcel.ActiveWindow.FreezePanes = True : myExcel.ActiveWindow.DisplayGridlines = False
  270. xlSheet.Range("F1").Select()
  271. myExcel.Application.PrintCommunication = False
  272. With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "" : .PrintTitleColumns = "" : End With
  273. myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
  274. With myExcel.ActiveSheet.PageSetup : .LeftHeader = "" : .CenterHeader = "" : .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "" : .RightFooter = ""
  275. .LeftMargin = myExcel.Application.InchesToPoints(0.25) : .RightMargin = myExcel.Application.InchesToPoints(0.25)
  276. .TopMargin = myExcel.Application.InchesToPoints(0.75) : .BottomMargin = myExcel.Application.InchesToPoints(0.75)
  277. .HeaderMargin = myExcel.Application.InchesToPoints(0.3) : .FooterMargin = myExcel.Application.InchesToPoints(0.3)
  278. .PrintHeadings = False : .PrintGridlines = False : .PrintQuality = 600 : .CenterHorizontally = False : .CenterVertically = False : .Draft = False
  279. .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = 1 : .OddAndEvenPagesHeaderFooter = False
  280. .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = ""
  281. .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = ""
  282. .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = ""
  283. .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
  284. End With
  285. myExcel.Application.PrintCommunication = True
  286. End Sub
  287. Private Sub GG(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
  288. Dim 位置1 As String
  289. Clipboard.SetDataObject(PictureBox1.Image)
  290. 位置1 = "A" & N1 : xlSheet.Range(位置1).Select()
  291. myExcel.ActiveSheet.Pictures.Paste.Select
  292. myExcel.Selection.ShapeRange.Width = 70
  293. myExcel.Selection.ShapeRange.IncrementLeft(3)
  294. myExcel.Selection.ShapeRange.IncrementTop(3)
  295. End Sub
  296. End Class