123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- Option Strict Off
- Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
- Imports Microsoft.Office.Interop.Excel.Constants
- Imports Microsoft.Office.Interop.Excel.XlBordersIndex
- Imports Microsoft.Office.Interop.Excel.XlLineStyle
- Imports Microsoft.Office.Interop.Excel.XlBorderWeight
- Imports Microsoft.Office.Interop.Excel.XlThemeFont
- Imports Microsoft.Office.Interop.Excel.XlThemeColor
- Imports Microsoft.Office.Interop.Excel.XlWindowState
- Imports Microsoft.Office.Interop.Excel
- Public Class 應付款日報表
- Dim 縮起來 As Boolean = False : Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet : Dim GGHH As Long = 0 : Dim BN As Long = 0
- Private Sub 語言轉換讀取()
- If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
- Me.Text = 系統語言字典("H001-141-" & 語言)
- 表頭(0) = 系統語言字典("H314-124-" & 語言) : 表頭(1) = 系統語言字典("G000-177-" & 語言) : 表頭(2) = 系統語言字典("H318-100-" & 語言)
- 表頭(3) = 系統語言字典("H318-101-" & 語言) : 表頭(4) = 系統語言字典("H318-102-" & 語言) : 表頭(5) = 系統語言字典("H314-124-" & 語言)
- Label2.Text = 系統語言字典("H318-103-" & 語言) : Label1.Text = 系統語言字典("H318-102-" & 語言)
- End Sub
- Private Sub 支付日期清單()
- Dim ds1 As New DataSet : 單據_dgv.DataSource = Nothing : ds1.Clear()
- 單據_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 單據_dgv.ColumnHeadersHeight = 25 : 單據_dgv.AllowUserToAddRows = False
- If HX_ch.Checked = True And PGS_ch.Checked = False Then : PA = "HXI" : Else : PA = "PGS" : End If
- SQL_支付日期(PA)
- da.Fill(ds1) : 單據_dgv.DataSource = ds1.Tables(0) : conn.Close()
- End Sub
- Private Sub 單據讀取()
- Dim ds1 As New DataSet : 餘額_dgv.DataSource = Nothing : ds1.Clear()
- 餘額_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 餘額_dgv.ColumnHeadersHeight = 30 : 餘額_dgv.AllowUserToAddRows = False : 餘額_dgv.RowTemplate.Height = 65
- SQL_餘額查詢(PA1, PA)
- da.Fill(ds1) : 餘額_dgv.DataSource = ds1.Tables(0) : conn.Close()
- 餘額_dgv.Columns(0).FillWeight = 40 : 餘額_dgv.Columns(1).FillWeight = 80 : 餘額_dgv.Columns(2).FillWeight = 250 : 餘額_dgv.Columns("排序").Visible = False
- 餘額_dgv.Columns(3).DefaultCellStyle.Format = "#,##0" : 餘額_dgv.Columns(4).DefaultCellStyle.Format = "#,##0"
- 餘額_dgv.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 餘額_dgv.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- 餘額_dgv.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 餘額_dgv.Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 餘額_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 餘額_dgv.Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 餘額_dgv.EditMode = DataGridViewEditMode.EditOnEnter : 餘額_dgv.Columns(0).ReadOnly = True : 餘額_dgv.Columns(1).ReadOnly = True
- 單據讀取1()
- If 餘額_dgv.Rows.Count > 0 Then : 餘額_dgv(1, 0).Value = PA1 : 餘額_dgv(2, 0).Value = "SISA SALDO SEBELUMNYA" : 餘額_dgv(3, 0).Value = "0" : End If
- For i As Integer = 0 To 餘額_dgv.Rows.Count - 1 : 餘額_dgv(0, i).Value = "" : 餘額_dgv(3, i).Value = "0" : Next
-
- Dim panel1Width As Integer : If 餘額_dgv.Rows.Count = 0 Then : panel1Width = 45 : Else : panel1Width = (65 * (餘額_dgv.Rows.Count)) + 3 + 30 : End If
- SplitContainer1.SplitterDistance = panel1Width : Dim totalHeight As Integer = SplitContainer1.Height - SplitContainer1.SplitterWidth
- SplitContainer1.Panel1MinSize = panel1Width : SplitContainer1.Panel2MinSize = totalHeight - panel1Width
-
- If 餘額_dgv.Rows.Count = 0 Then : panel1Width = 45 : Else : panel1Width = (65 * (餘額_dgv.Rows.Count)) + 3 + 30 : End If
- SplitContainer1.SplitterDistance = panel1Width : totalHeight = SplitContainer1.Height - SplitContainer1.SplitterWidth
- SplitContainer1.Panel1MinSize = panel1Width : SplitContainer1.Panel2MinSize = totalHeight - panel1Width
-
- Dim 可放 As Double = 付款資料_dgv.Size.Height / 65
- If 付款資料_dgv.Rows.Count >= 可放 Then
- If 縮起來 = False Then : 餘額_dgv.Size = New Size(餘額_dgv.Size.Width - 19, 餘額_dgv.Size.Height) : 縮起來 = True : End If
- Else
- If 縮起來 = True Then : 餘額_dgv.Size = New Size(餘額_dgv.Size.Width + 19, 餘額_dgv.Size.Height) : 縮起來 = False : End If
- End If
- 餘額計算()
- End Sub
- Private Sub 單據讀取1()
- Dim ds1 As New DataSet : 付款資料_dgv.DataSource = Nothing : ds1.Clear()
- 付款資料_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 付款資料_dgv.ColumnHeadersHeight = 25 : 付款資料_dgv.AllowUserToAddRows = False
- 付款資料_dgv.RowTemplate.Height = 65 : 付款資料_dgv.ColumnHeadersVisible = False
- SQL_帳務查詢(PA1, PA)
- da.Fill(ds1) : 付款資料_dgv.DataSource = ds1.Tables(0) : conn.Close()
- 付款資料_dgv.Columns(0).FillWeight = 40 : 付款資料_dgv.Columns(1).FillWeight = 80 : 付款資料_dgv.Columns(2).FillWeight = 250
-
- 付款資料_dgv.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 付款資料_dgv.Columns(0).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- 付款資料_dgv.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 付款資料_dgv.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- 付款資料_dgv.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 付款資料_dgv.Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 付款資料_dgv.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 付款資料_dgv.Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 付款資料_dgv.Columns(0).ReadOnly = True : 付款資料_dgv.Columns(1).ReadOnly = True : 付款資料_dgv.Columns(2).ReadOnly = True
- 付款資料_dgv.Columns(3).ReadOnly = True : 付款資料_dgv.Columns(4).ReadOnly = True
- For i As Integer = 0 To 付款資料_dgv.Rows.Count - 1
- 付款資料_dgv(0, i).Value = i + 1
- 付款資料_dgv(3, i).Value = Strings.Format(CDbl(付款資料_dgv(3, i).Value.ToString), "#,##0")
- 付款資料_dgv(4, i).Value = Strings.Format(CDbl(付款資料_dgv(4, i).Value.ToString), "#,##0")
- Next
- End Sub
- Private Sub 應付款日報表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- H(318) = True : 介面 = "H318" : 顯示說明(999, False)
-
- 單據_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
- End Sub
- Private Sub 應付款日報表_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
- PictureBox2.SendToBack() : 語言轉換讀取() : 支付日期清單()
- End Sub
- Private Sub 應付款日報表_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
- H(318) = False : MyMod.虛擬桌面開啟()
- End Sub
- Private Sub 應付款日報表_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
- MyMod.清單字體大小調整()
- 單據_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
- End Sub
- Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
- timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
- End Sub
- Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
- timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
- End Sub
- Private Sub 餘額計算()
- 支出_tb.Text = "0" : 彙總_tb.Text = "0"
- For i As Integer = 0 To 付款資料_dgv.Rows.Count - 1 : 支出_tb.Text = CDbl(支出_tb.Text) + CDbl(付款資料_dgv(3, i).Value.ToString) : Next
- For i As Integer = 0 To 餘額_dgv.Rows.Count - 1 : 彙總_tb.Text = CDbl(彙總_tb.Text) + CDbl(餘額_dgv(4, i).Value.ToString) : Next
- 彙總_tb.Text = Strings.Format((CDbl(彙總_tb.Text) - CDbl(支出_tb.Text)), "#,##0") : 支出_tb.Text = Strings.Format(CDbl(支出_tb.Text), "#,##0")
- End Sub
- Private Sub 餘額_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 餘額_dgv.CellEndEdit
- 餘額計算()
- End Sub
- Private Sub HX_ch_CheckedChanged(sender As Object, e As EventArgs) Handles HX_ch.Click
- PictureBox2.SendToBack() : HX_ch.Checked = True : PGS_ch.Checked = False : 支付日期清單()
- End Sub
- Private Sub PGS_ch_CheckedChanged(sender As Object, e As EventArgs) Handles PGS_ch.Click
- PictureBox1.SendToBack() : HX_ch.Checked = False : PGS_ch.Checked = True : 支付日期清單()
- End Sub
- Private Sub 單據_dgv_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles 單據_dgv.CellClick
- If e.RowIndex = -1 Then : Else
- PA1 = 單據_dgv(0, e.RowIndex).Value.ToString : If HX_ch.Checked = True And PGS_ch.Checked = False Then : PA = "HXI" : Else : PA = "PGS" : End If : PA4 = ""
- 單據讀取() : If 餘額_dgv.Rows.Count = 0 Then : PA2 = "SISA SALDO SEBELUMNYA" : PA3 = "1" : SQL_餘額查詢_新增(PA1, PA, PA2, PA3) : 單據讀取() : End If
- End If
- End Sub
- Private Sub 餘額_dgv_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles 餘額_dgv.CellClick
- If e.RowIndex = -1 Then : Else : PA4 = 餘額_dgv("排序", e.RowIndex).Value.ToString : End If
- End Sub
- Private Sub 開立收支單_bt_Click(sender As Object, e As EventArgs) Handles 開立收支單_bt.Click
- If 付款資料_dgv.Rows.Count > 0 Then
- PA3 = 餘額_dgv.Rows.Count + 1 : PA2 = "" : If HX_ch.Checked = True And PGS_ch.Checked = False Then : PA = "HXI" : Else : PA = "PGS" : End If
- SQL_餘額查詢_新增(PA1, PA, PA2, PA3) : 單據讀取()
- End If
- End Sub
- Private Sub 刪除收支單_bt_Click(sender As Object, e As EventArgs) Handles 刪除收支單_bt.Click
- If PA4 <> "" And PA4 <> "1" Then
- If HX_ch.Checked = True And PGS_ch.Checked = False Then : PA = "HXI" : Else : PA = "PGS" : End If : SQL_餘額查詢_刪除(PA1, PA, PA4) : 單據讀取() : PA4 = ""
- End If
- End Sub
- Private Sub 申請完成_bt_Click(sender As Object, e As EventArgs) Handles 申請完成_bt.Click
- If 餘額_dgv.Rows.Count > 0 Then
- If HX_ch.Checked = True And PGS_ch.Checked = False Then : PA = "HXI" : Else : PA = "PGS" : End If
- For i As Integer = 0 To 餘額_dgv.Rows.Count - 1
- PA5 = 餘額_dgv(4, i).Value.ToString : PA4 = 餘額_dgv("排序", i).Value.ToString : PA2 = 餘額_dgv(2, i).Value.ToString
- SQL_餘額查詢_修改(PA1, PA, PA5, PA4, PA2)
- Next : MGB(系統語言字典("G000-119-" & 語言), 1)
- End If
- End Sub
- Private Sub 列印成EXCEL_bt_Click(sender As Object, e As EventArgs) Handles 列印成EXCEL_bt.Click
- If 餘額_dgv.Rows.Count > 0 Then
- xlApp = CType(CreateObject("Excel.Application"), Application)
- xlBook = xlApp.Workbooks.Add
- xlApp.DisplayAlerts = True
- xlApp.Visible = True
- xlApp.Application.WindowState = xlMaximized
-
- xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select
- xlApp.Sheets(1).Name = PA1.Replace("/", "_") : xlBook.Activate() : xlSheet.Activate()
-
- xlSheet.Cells(5, 2) = "No" : xlSheet.Cells(5, 3) = 表頭(1) : xlSheet.Cells(5, 4) = 表頭(2) : xlSheet.Cells(5, 5) = 表頭(3) : xlSheet.Cells(5, 6) = 表頭(4)
- GGHH = 0 : BN = 0
- For i As Integer = 0 To 餘額_dgv.Rows.Count - 1
- xlSheet.Cells(i + 6, 2) = 餘額_dgv.Rows(i).Cells(0).Value.ToString : xlSheet.Cells(i + 6, 3) = 餘額_dgv.Rows(i).Cells(1).Value.ToString
- xlSheet.Cells(i + 6, 4) = 餘額_dgv.Rows(i).Cells(2).Value.ToString : xlSheet.Cells(i + 6, 5) = 餘額_dgv.Rows(i).Cells(3).Value.ToString
- xlSheet.Cells(i + 6, 6) = 餘額_dgv.Rows(i).Cells(4).Value.ToString : GGHH += 1
- Next : BN = GGHH
- For i As Integer = 0 To 付款資料_dgv.Rows.Count - 1
- xlSheet.Cells(i + 6 + GGHH, 2) = 付款資料_dgv.Rows(i).Cells(0).Value.ToString : xlSheet.Cells(i + 6 + GGHH, 3) = 付款資料_dgv.Rows(i).Cells(1).Value.ToString
- xlSheet.Cells(i + 6 + GGHH, 4) = 付款資料_dgv.Rows(i).Cells(2).Value.ToString : xlSheet.Cells(i + 6 + GGHH, 5) = 付款資料_dgv.Rows(i).Cells(3).Value.ToString
- xlSheet.Cells(i + 6 + GGHH, 6) = 付款資料_dgv.Rows(i).Cells(4).Value.ToString : BN += 1
- Next
- xlSheet.Cells(6 + BN, 2) = Label2.Text : xlSheet.Cells(6 + BN, 5) = 支出_tb.Text
- xlSheet.Cells(6 + BN + 1, 2) = Label1.Text : xlSheet.Cells(6 + BN + 1, 5) = 彙總_tb.Text
- AA(xlApp, xlSheet) : FF(xlApp, xlSheet)
- If HX_ch.Checked = True And PGS_ch.Checked = False Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If
- xlApp.Sheets(2).Delete : xlSheet.PageSetup.PrintArea = ""
- '-------------轉換成PDF---------------------------------------------------------------------
- Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
- xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & PA1.Replace("/", "_") & ".pdf", XlFixedFormatQuality.xlQualityStandard, True)
- '-------------關閉EXCEL---------------------------------------------------------------------
- xlApp.Cells.Select() : xlApp.Application.WindowState = xlMinimized
- xlBook.Close(False)
- Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet)
- Runtime.InteropServices.Marshal.ReleaseComObject(xlBook)
- Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
- xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect()
- '-------------開啟PDF---------------------------------------------------------------------
- Dim pdfFilePath As String = SERT & "\" & PA1.Replace("/", "_") & ".pdf"
- If IsChromeInstalled() Then
- Try
- Dim chromeProcess As New Process()
- chromeProcess.StartInfo.FileName = "chrome"
- chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """"
- chromeProcess.Start()
- Catch ex As Exception
- End Try
- Else
- Try
- System.Diagnostics.Process.Start("""" & pdfFilePath & """")
- Catch ex As Exception
- End Try
- End If
- MGB(系統語言字典("H508-121-" & 語言), 1) : 首次開啟 = False
- End If
- End Sub
- Private Function IsChromeInstalled() As Boolean
- Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
- If key IsNot Nothing Then
- For Each subkeyName As String In key.GetSubKeyNames()
- Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName)
- Dim displayName As Object = subkey.GetValue("DisplayName")
-
- If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then
- Return True
- End If
- Next
- End If
- Return False
- End Function
- Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
- Return CType(xlBook.Worksheets.Add, Worksheet)
- End Function
- Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
- xlSheet.Cells.Select()
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
- .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- xlSheet.Rows("5:5").Select : myExcel.Selection.RowHeight = 35
- With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
- xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 6
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
- .ReadingOrder = xlContext : .MergeCells = False : End With
- xlSheet.Columns("C:C").Select : myExcel.Selection.NumberFormatLocal = "yyyy/mm/dd" : myExcel.Selection.ColumnWidth = 12
- xlSheet.Columns("E:E").Select : myExcel.Selection.ColumnWidth = 18
- xlSheet.Columns("F:F").Select : myExcel.Selection.ColumnWidth = 18
- xlSheet.Columns("D:D").Select : myExcel.Selection.ColumnWidth = 70
- With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
- xlSheet.Range("C5:F5").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
- xlSheet.Range("B" & BN + 6 & ":D" & BN + 6).Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
- .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("B" & BN + 6 + 1 & ":D" & BN + 6 + 1).Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0 : .ShrinkToFit = False
- .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("E" & BN + 6 + 1 & ":F" & BN + 6 + 1).Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows(BN + 6 & ":" & BN + 6 + 1).Select : myExcel.Selection.RowHeight = 30
- xlSheet.Range("B5:F5").Select()
- With myExcel.Selection.Interior : .Pattern = xlSolid : .PatternColorIndex = xlAutomatic : .ThemeColor = xlThemeColorAccent2 : .TintAndShade = 0.599993896298105
- .PatternTintAndShade = 0 : End With
- xlSheet.Range("B5:F" & BN + 6 + 1).Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- xlSheet.Rows("2:2").Select : myExcel.Selection.RowHeight = 30
- xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 35
- xlSheet.Rows(BN + 6 & ":" & BN + 6 + 1).Select : myExcel.Selection.Font.Bold = True : myExcel.ActiveWindow.DisplayGridlines = False
- xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 1
- xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 1
- xlSheet.Range("E6:F" & BN + 6 + 1).Select() : myExcel.Selection.Style = "Comma" : myExcel.Selection.NumberFormatLocal = "_-* #,##0_-;-* #,##0_-;_-* ""-""??_-;_-@_-"
- Dim 攔寬 As Double
- For i As Integer = 6 To BN + 6 - 1
- xlSheet.Rows(i & ":" & i).Select : 攔寬 = xlSheet.Rows(i & ":" & i).RowHeight
- xlSheet.Rows(i & ":" & i).Select : myExcel.Selection.RowHeight = 攔寬 + 10
- Next
- End Sub
- Private Sub CC(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
- Clipboard.SetDataObject(合約報價單.PictureBox1.Image)
- xlSheet.Range("B1").Select()
- myExcel.ActiveSheet.Pictures.Paste.Select
- myExcel.Selection.ShapeRange.Height = 93
- myExcel.Selection.ShapeRange.IncrementLeft(50)
- myExcel.Selection.ShapeRange.IncrementTop(0)
- End Sub
- Private Sub DD(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Worksheet)
- Clipboard.SetDataObject(合約報價單.PictureBox2.Image)
- xlSheet.Range("B1").Select()
- myExcel.ActiveSheet.Pictures.Paste.Select
- myExcel.Selection.ShapeRange.Height = 93
- myExcel.Selection.ShapeRange.IncrementLeft(50)
- myExcel.Selection.ShapeRange.IncrementTop(0)
- End Sub
- Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
- If HX_ch.Checked = True And PGS_ch.Checked = False Then
- myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
- Str01 & "\HXBWLOG.png"
- Else
- myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
- Str01 & "\PGSBWLOG.png"
- End If
- myExcel.Application.PrintCommunication = False
- With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$10" : .PrintTitleColumns = "" : End With
- myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
- With myExcel.ActiveSheet.PageSetup : .LeftHeader = ""
- .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G"
- .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = ""
- .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
- .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
- .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
- .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = False : .CenterVertically = False : .Draft = False
- .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False
- .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True : .EvenPage.LeftHeader.Text = ""
- .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = "" : .EvenPage.CenterFooter.Text = ""
- .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = "" : .FirstPage.RightHeader.Text = ""
- .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
- End With : myExcel.Application.PrintCommunication = True
- End Sub
- End Class
|