1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051 |
- 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
- Imports System.Drawing.Printing
- Imports System.Text
- Imports System.IO
- Public Class 公函
- Dim xlApp As Microsoft.Office.Interop.Excel.Application
- Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
- Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
- Dim 位置1 As String
- Dim N2 As Integer : Dim N3 As Integer
- ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet
- ReadOnly QRCODE As DotNetBarcode = New DotNetBarcode
- Private Sub 公函_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = ICS_ASMS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- SQL_讀取公司資料()
- If dr.Read() Then
- 公司名稱.Text = dr("公司名稱")
- 地址.Text = dr("地址")
- 電話.Text = dr("電話")
- 傳真.Text = dr("傳真")
- 簡稱.Text = dr("簡稱")
- End If
- conn.Close()
- 已核准的營運成本收支單_rb.Checked = True
- 作廢的營運成本收支單_rb.Checked = False
- Set_清單1()
- 刪除_bt.Enabled = False : 儲存_bt.Enabled = False : 作廢_bt.Enabled = False : 列印_bt.Enabled = False
-
- End Sub
-
- Private Sub Set_清單1()
- 控制表_dgv.DataSource = Nothing : ds1.Clear()
- 控制表_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 控制表_dgv.ColumnHeadersHeight = 25
- 控制表_dgv.AllowUserToAddRows = False
- 控制表_dgv.RowTemplate.Height = 30
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- If 作廢的營運成本收支單_rb.Checked = True And 已核准的營運成本收支單_rb.Checked = False Then
- SQL_公函_控制表清單1()
- ElseIf 作廢的營運成本收支單_rb.Checked = False And 已核准的營運成本收支單_rb.Checked = True Then
- SQL_公函_控制表清單()
- End If
- da.Fill(ds1) : 控制表_dgv.DataSource = ds1.Tables(0) : conn.Close()
- 控制表_dgv.Columns(0).FillWeight = 20 : 控制表_dgv.Columns(1).Visible = False : 控制表_dgv.Columns(2).Visible = False
- 控制表_dgv.Columns(3).Visible = False : 控制表_dgv.Columns(4).Visible = False : 控制表_dgv.Columns(5).Visible = False
- 控制表_dgv.Columns(6).Visible = False : 控制表_dgv.Columns(8).Visible = False : 控制表_dgv.Columns(7).FillWeight = 20
- 控制表_dgv.Columns(9).Visible = False : 控制表_dgv.Columns(10).Visible = False : 控制表_dgv.Columns(11).Visible = False
- 控制表_dgv.Columns(12).Visible = False : 控制表_dgv.Columns(13).Visible = False : 控制表_dgv.Columns(14).Visible = False
-
- End Sub
- Private Sub 縮放_tb_Click(sender As Object, e As EventArgs) Handles 縮放_tb.Click
- If 控制表_dgv.Size.Width = 200 Then
- 控制表_dgv.Size = New Size(620, 控制表_dgv.Size.Height)
- 控制表_dgv.Columns(7).FillWeight = 120
- 控制表_dgv.Columns(0).FillWeight = 20
- Else
- 控制表_dgv.Size = New Size(200, 控制表_dgv.Size.Height)
- 控制表_dgv.Columns(7).FillWeight = 20
- 控制表_dgv.Columns(0).FillWeight = 20
- 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
- 單號_tb.Text = 控制表_dgv(0, e.RowIndex).Value.ToString
- Dim dateString As String = 控制表_dgv(1, e.RowIndex).Value.ToString
- Dim dateParts() As String = dateString.Split("/"c)
- Dim year As Integer = Integer.Parse(dateParts(0)) + 1911 ' 將民國年轉換為西元年
- Dim month As Integer = Integer.Parse(dateParts(1))
- Dim day As Integer = Integer.Parse(dateParts(2))
- Dim dateTime As New DateTime(year, month, day)
- 選擇日期_dtp.Value = dateTime
- 選擇日期_dtp.CustomFormat = "yyyy/MM/dd"
- 選擇日期_dtp.Format = DateTimePickerFormat.Custom
- 承辦人_tb.Text = 控制表_dgv(2, e.RowIndex).Value.ToString
- 受文者_tb.Text = 控制表_dgv(3, e.RowIndex).Value.ToString
- 速別_tb.Text = 控制表_dgv(4, e.RowIndex).Value.ToString
- 密等_tb.Text = 控制表_dgv(5, e.RowIndex).Value.ToString
- 附件_tb.Text = 控制表_dgv(6, e.RowIndex).Value.ToString
- 主旨_tb.Text = 控制表_dgv(7, e.RowIndex).Value.ToString
- 說明_tb.Text = 控制表_dgv(8, e.RowIndex).Value.ToString
- 說明_rtb.Text = 控制表_dgv(8, e.RowIndex).Value.ToString
- 正本_tb.Text = 控制表_dgv(9, e.RowIndex).Value.ToString
- 副本_tb.Text = 控制表_dgv(10, e.RowIndex).Value.ToString
- 手機_tb.Text = 控制表_dgv(13, e.RowIndex).Value.ToString
- 標題_tb.Text = 控制表_dgv(14, e.RowIndex).Value.ToString
- If 登入人級別 <> "00" Then
- If 控制表_dgv(12, e.RowIndex).Value = True Then
- 刪除_bt.Enabled = False : 儲存_bt.Enabled = False : 作廢_bt.Enabled = False : 列印_bt.Enabled = True : 新增_bt.Enabled = True
- ElseIf 控制表_dgv(11, e.RowIndex).Value = True And 控制表_dgv(12, e.RowIndex).Value = False Then
- 刪除_bt.Enabled = False : 儲存_bt.Enabled = False : 作廢_bt.Enabled = True : 列印_bt.Enabled = True : 新增_bt.Enabled = True
- ElseIf 控制表_dgv(11, e.RowIndex).Value = False And 控制表_dgv(12, e.RowIndex).Value = False Then
- 刪除_bt.Enabled = True : 儲存_bt.Enabled = True : 作廢_bt.Enabled = True : 列印_bt.Enabled = True : 新增_bt.Enabled = True
- End If
- Else
- 刪除_bt.Enabled = True : 儲存_bt.Enabled = True : 作廢_bt.Enabled = True : 列印_bt.Enabled = True : 新增_bt.Enabled = True
- End If
-
-
- End If
- End Sub
- Private Sub 複製_bt_Click(sender As Object, e As EventArgs) Handles 複製_bt.Click
- 刪除_bt.Enabled = True : 儲存_bt.Enabled = True : 作廢_bt.Enabled = False : 列印_bt.Enabled = False : 新增_bt.Enabled = False
- 受文者_tb.Text = "" : 正本_tb.Text = ""
- Dim NUM1 As Integer
- Dim selectedDate As DateTime = 選擇日期_dtp.Value
- Dim taiwanYear As Integer = selectedDate.Year - 1911
- Dim str As String = String.Format("{0}{1:00}{2:00}", taiwanYear, selectedDate.Month, selectedDate.Day)
- PA1 = String.Format("{0}/{1:00}/{2:00}", taiwanYear, selectedDate.Month, selectedDate.Day)
- For i As Integer = 1 To 999
- NUM1 = 0 + i
- If NUM1 < 10 Then : 單號_tb.Text = str & "0" & NUM1
- ElseIf NUM1 > 9 Then : 單號_tb.Text = str & NUM1
- End If
- conn.Close()
- PA = 單號_tb.Text
- SQL_公函_查詢第一筆單號()
- If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
- Next
- PA = 單號_tb.Text
- SQL_公函_新增一筆公函控制表() : conn.Close()
- End Sub
- Private Sub 新增_bt_Click(sender As Object, e As EventArgs) Handles 新增_bt.Click
- 單號_tb.Text = "" : 承辦人_tb.Text = gUserName : 手機_tb.Text = "" : 受文者_tb.Text = ""
- 速別_tb.Text = "" : 密等_tb.Text = "" : 主旨_tb.Text = "" : 說明_tb.Text = "" : 說明_rtb.Text = ""
- 正本_tb.Text = "" : 副本_tb.Text = "" : 附件_tb.Text = "" : 標題_tb.Text = 公司名稱.Text & "管理委員會"
- Dim NUM1 As Integer
- Dim selectedDate As DateTime = 選擇日期_dtp.Value
- Dim taiwanYear As Integer = selectedDate.Year - 1911
- Dim str As String = String.Format("{0}{1:00}{2:00}", taiwanYear, selectedDate.Month, selectedDate.Day)
- PA1 = String.Format("{0}/{1:00}/{2:00}", taiwanYear, selectedDate.Month, selectedDate.Day)
- For i As Integer = 1 To 999
- NUM1 = 0 + i
- If NUM1 < 10 Then : 單號_tb.Text = str & "0" & NUM1
- ElseIf NUM1 > 9 Then : 單號_tb.Text = str & NUM1
- End If
- conn.Close()
- PA = 單號_tb.Text
- SQL_公函_查詢第一筆單號()
- If dr.Read() Then : Else : i = 999 : conn.Close() : End If : conn.Close()
- Next
- PA = 單號_tb.Text
- SQL_公函_新增一筆公函控制表() : conn.Close()
-
- 刪除_bt.Enabled = True : 儲存_bt.Enabled = True : 作廢_bt.Enabled = False : 列印_bt.Enabled = False : 新增_bt.Enabled = False
- End Sub
-
- Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
- SQL_公函_控制表刪除() : conn.Close() : MsgBox("刪除成功!!")
- 單號_tb.Text = "" : 承辦人_tb.Text = "" : 手機_tb.Text = "" : 受文者_tb.Text = ""
- 速別_tb.Text = "" : 密等_tb.Text = "" : 主旨_tb.Text = "" : 說明_tb.Text = "" : 說明_rtb.Text = ""
- 正本_tb.Text = "" : 副本_tb.Text = "" : 附件_tb.Text = "" : Set_清單1()
- If 登入人級別 <> "00" Then
- 刪除_bt.Enabled = False : 儲存_bt.Enabled = False : 作廢_bt.Enabled = False : 列印_bt.Enabled = False : 新增_bt.Enabled = True
- End If
-
- End Sub
-
- Private Sub 儲存_bt_Click(sender As Object, e As EventArgs) Handles 儲存_bt.Click
- If 承辦人_tb.Text = gUserName Or 登入人級別 = "00" Then
- Dim selectedDate As DateTime = 選擇日期_dtp.Value
- Dim taiwanYear As Integer = selectedDate.Year - 1911
- PA1 = String.Format("{0}/{1:00}/{2:00}", taiwanYear, selectedDate.Month, selectedDate.Day)
- SQL_公函_控制表修改() : conn.Close() : MsgBox("儲存成功!!") : Set_清單1()
- If 登入人級別 <> "00" Then
- 刪除_bt.Enabled = True : 儲存_bt.Enabled = True : 作廢_bt.Enabled = True : 列印_bt.Enabled = True : 新增_bt.Enabled = True
- End If
- Else
- MsgBox("請確認開單人是否為本人")
- End If
-
-
- End Sub
-
- Private Sub 作廢_bt_Click(sender As Object, e As EventArgs) Handles 作廢_bt.Click
- SQL_公函_控制表作廢() : conn.Close() : MsgBox("作廢成功!!") : Set_清單1()
- If 登入人級別 <> "00" Then
- 刪除_bt.Enabled = False : 儲存_bt.Enabled = False : 作廢_bt.Enabled = False : 列印_bt.Enabled = True : 新增_bt.Enabled = True
- End If
-
- End Sub
- Private Sub 作廢的營運成本收支單_rb_CheckedChanged(sender As Object, e As EventArgs) Handles 作廢的營運成本收支單_rb.Click
- 作廢的營運成本收支單_rb.Checked = True : 已核准的營運成本收支單_rb.Checked = False
- Set_清單1()
- End Sub
- Private Sub 已核准的營運成本收支單_rb_CheckedChanged(sender As Object, e As EventArgs) Handles 已核准的營運成本收支單_rb.Click
- 作廢的營運成本收支單_rb.Checked = False : 已核准的營運成本收支單_rb.Checked = True
- Set_清單1()
- End Sub
- Private Sub 字體_NUD_ValueChanged(sender As Object, e As EventArgs) Handles 字體_NUD.ValueChanged
- 受文者_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 速別_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 密等_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 主旨_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 說明_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 說明_rtb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 正本_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 副本_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- 附件_tb.Font = New System.Drawing.Font("微軟正黑體", 字體_NUD.Value)
- End Sub
-
- Private Sub 查詢_tb_Click(sender As Object, e As EventArgs) Handles 查詢_tb.Click
- PA56 = InputBox("請輸入要查詢的單號資料。") : Set_清單1() : PA56 = ""
- End Sub
- Private Sub 複製_bt_MouseEnter(sender As Object, e As EventArgs) Handles 複製_bt.MouseEnter
- ToolTip1.SetToolTip(Me.複製_bt, "複製文件")
- End Sub
- Private Sub 確縮放_tb_MouseEnter(sender As Object, e As EventArgs) Handles 縮放_tb.MouseEnter
- ToolTip1.SetToolTip(Me.縮放_tb, "主旨縮放")
- End Sub
- Private Sub 查詢_tb_MouseEnter(sender As Object, e As EventArgs) Handles 查詢_tb.MouseEnter
- ToolTip1.SetToolTip(Me.查詢_tb, "關鍵字搜尋")
- End Sub
- Private Sub 新增_bt_MouseEnter(sender As Object, e As EventArgs) Handles 新增_bt.MouseEnter
- ToolTip1.SetToolTip(Me.新增_bt, "新增")
- End Sub
- Private Sub 確認新增_bt_MouseEnter(sender As Object, e As EventArgs) Handles 儲存_bt.MouseEnter
- ToolTip1.SetToolTip(Me.儲存_bt, "儲存")
- End Sub
- Private Sub 修改_bt_MouseEnter(sender As Object, e As EventArgs) Handles 作廢_bt.MouseEnter
- ToolTip1.SetToolTip(Me.作廢_bt, "作廢")
- End Sub
- Private Sub 刪除_bt_MouseEnter(sender As Object, e As EventArgs) Handles 刪除_bt.MouseEnter
- ToolTip1.SetToolTip(Me.刪除_bt, "刪除")
- End Sub
- Private Sub 匯出EXCEL_bt_MouseEnter(sender As Object, e As EventArgs) Handles 列印_bt.MouseEnter
- ToolTip1.SetToolTip(Me.列印_bt, "匯出PDF")
- End Sub
-
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
-
- QRCode2_pb.Image = Nothing
- QRCode2_pb.Image = New Bitmap(QRCode2_pb.Width, QRCode2_pb.Height)
- Dim GP2 As Graphics = Graphics.FromImage(QRCode2_pb.Image)
- QRCODE.Type = DotNetBarcode.Types.QRCode : QRCODE.QRQuitZone = 0 : QRCODE.QRWriteBar("http://106.1.48.106:8080/ICS-SCADA-SYS/index2.html", 1, 1, 2.5, GP2)
- QRCode2_pb.SizeMode = 4
-
-
- Dim printDocument As New PrintDocument()
- AddHandler printDocument.PrintPage, AddressOf PrintPageHandler
-
- Dim printDialog As New PrintDialog()
- printDialog.Document = printDocument
-
- If printDialog.ShowDialog() = DialogResult.OK Then
- printDocument.Print()
- End If
- End Sub
- Private Sub PrintPageHandler(sender As Object, e As PrintPageEventArgs)
- ' 在這個事件處理程序中,你可以使用 e.Graphics 繪製要列印的內容
- Dim graphics As Graphics = e.Graphics
- Dim newFont As New System.Drawing.Font("標楷體", 18)
- Dim brush As New SolidBrush(Color.Black)
- 'Dim printText As String = "光明燈"
- 'Dim printText1 As String = "伍佰元整"
- 'Dim printText2 As String = "王詩文"
- Dim printText3 As String = "王詩文"
- Dim printText4 As String = "王詩文"
- Dim printText5 As String = "112"
- Dim printText6 As String = "10"
- Dim printText7 As String = "08"
- Dim newFont1 As New System.Drawing.Font("標楷體", 14)
- 'Dim newFont1 As New System.Drawing.Font("標楷體", 18)
- Dim printText As String = "明細如下"
- Dim printText1 As String = "玖仟玖佰元整"
- Dim printText2 As String = "王詩文(闔家人等)"
- Dim printText31 As String = "光明燈*3"
- Dim printText41 As String = "太歲燈*3"
- Dim printText51 As String = "智慧燈*3"
- Dim printText61 As String = "財利燈*3"
- Dim printText71 As String = "姻緣燈*3"
- Dim printText81 As String = "延壽燈*3"
- Dim printText91 As String = "解厄燈*3"
- graphics.DrawString(printText, newFont, brush, 370, 75)
- graphics.DrawString(printText2, newFont, brush, 0, 230)
- graphics.DrawString(printText31, newFont1, brush, 0, 275)
- graphics.DrawString(printText41, newFont1, brush, 0, 300)
- graphics.DrawString(printText51, newFont1, brush, 0, 325)
- graphics.DrawString(printText61, newFont1, brush, 0, 350)
- graphics.DrawString(printText71, newFont1, brush, 0, 375)
- graphics.DrawString(printText81, newFont1, brush, 0, 400)
- graphics.DrawString(printText91, newFont1, brush, 0, 425)
-
- 'graphics.DrawString(printText, newFont, brush, 375, 75)
- graphics.DrawString(printText1, newFont, brush, 70, 125)
- 'graphics.DrawString(printText2, newFont, brush, 70, 230)
- graphics.DrawString(printText3, newFont, brush, 380, 380)
- graphics.DrawString(printText4, newFont, brush, 350, 430)
- graphics.DrawString(printText5, newFont, brush, 140, 485)
- graphics.DrawString(printText6, newFont, brush, 300, 485)
- graphics.DrawString(printText7, newFont, brush, 440, 485)
- Dim qrCodeImage As Image = QRCode2_pb.Image
- ' 將QR Code 圖片繪製到指定位置
- graphics.DrawImage(qrCodeImage, 520, 5)
-
- e.HasMorePages = False ' 如果有多頁要列印,設置為 True
- End Sub
-
- Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
- SQL_公函_控制表鎖定() : conn.Close()
- If 登入人級別 <> "00" Then
- 刪除_bt.Enabled = False : 儲存_bt.Enabled = False : 作廢_bt.Enabled = True : 列印_bt.Enabled = True : 新增_bt.Enabled = True
- End If
- Set_清單1()
- xlApp = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
- xlApp.Visible = True
- xlApp.DisplayAlerts = True
- xlApp.Application.WindowState = xlMaximized
- xlBook = xlApp.Workbooks.Add
- xlSheet = NewMethod(xlBook)
- xlBook.Activate()
- xlSheet.Activate()
- xlSheet.Cells(1, 1) = 標題_tb.Text & " 函"
- xlSheet.Cells(2, 7) = "機關地址:" : xlSheet.Cells(2, 8) = 地址.Text
- xlSheet.Cells(3, 7) = "電 話:" : xlSheet.Cells(3, 8) = 電話.Text : xlSheet.Cells(3, 9) = "傳 真:" : xlSheet.Cells(3, 10) = 傳真.Text
- xlSheet.Cells(4, 7) = "承 辦 人:" : xlSheet.Cells(4, 8) = 承辦人_tb.Text
- If 手機_tb.Text <> "" Then
- xlSheet.Cells(4, 9) = "手 機:" : xlSheet.Cells(4, 10) = "'" & 手機_tb.Text
- End If
- xlSheet.Cells(5, 1) = "受文者:" : xlSheet.Cells(5, 5) = 受文者_tb.Text : xlSheet.Cells(5, 11) = 受文者_tb.Text
- Dim selectedDate As DateTime = 選擇日期_dtp.Value
- Dim taiwanYear As Integer = selectedDate.Year - 1911
-
- xlSheet.Cells(6, 1) = "發文日期:" : xlSheet.Cells(6, 4) = "中華民國" & taiwanYear & "年" & selectedDate.Month & "月" & selectedDate.Day & "日"
- xlSheet.Cells(7, 1) = "發文字號:" : xlSheet.Cells(7, 4) = 簡稱.Text & "字第 " & 單號_tb.Text & " 號"
- xlSheet.Cells(8, 1) = "速別:" : xlSheet.Cells(8, 2) = 速別_tb.Text : xlSheet.Cells(8, 11) = 速別_tb.Text
- xlSheet.Cells(9, 1) = "密等及解密條件:" : xlSheet.Cells(9, 6) = 密等_tb.Text : xlSheet.Cells(9, 11) = 密等_tb.Text
- xlSheet.Cells(10, 1) = "附件:" : xlSheet.Cells(10, 2) = 附件_tb.Text : xlSheet.Cells(10, 11) = 附件_tb.Text
- xlSheet.Cells(11, 1) = "主旨:" : xlSheet.Cells(11, 3) = 主旨_tb.Text : xlSheet.Cells(11, 11) = 主旨_tb.Text
- If 說明_rtb.Text <> "" Then
-
- Dim lines As New List(Of String)()
- Dim text As String = 說明_rtb.Text
- lines.Clear()
- ' 使用 Graphics.MeasureString 测量文本的宽度
- Using g As Graphics = CreateGraphics()
- Dim currentLine As String = ""
-
- For Each c As Char In text
- If c = ControlChars.Lf Then
- ' 如果遇到换行符号,添加一个新的段落
- lines.Add(currentLine)
- currentLine = ""
- Else
- currentLine += c
-
- ' 计算当前行的宽度
- Dim width As Integer = TextRenderer.MeasureText(currentLine, 說明_rtb.Font).Width
-
- ' 当宽度接近 RichTextBox 的宽度时,添加一个分段符号
- If width >= 450 Then
- lines.Add(currentLine)
- currentLine = ""
- End If
- End If
- Next
-
- ' 如果最后一行没有被添加,添加它
- If currentLine <> "" Then
- lines.Add(currentLine)
- End If
- End Using
- For i As Integer = 0 To lines.Count - 1
- 字串處理(lines(i))
- lines(i) = 已處理字串
- Next
- xlSheet.Cells(12, 1) = "說明:"
- 'For i = 0 To lines.Length - 1
- ' xlSheet.Cells(12 + i, 3) = lines(i) : xlSheet.Cells(12 + i, 11) = lines(i) & vbLf
- ' N2 = i + 12
- 'Next
- For i = 0 To lines.Count - 1
- xlSheet.Cells(12 + i, 3) = lines(i) : xlSheet.Cells(12 + i, 11) = lines(i)
- N2 = i + 12
- Next
- xlSheet.Cells(N2 + 1, 1) = "正本:" : xlSheet.Cells(N2 + 1, 2) = 正本_tb.Text : xlSheet.Cells(N2 + 1, 11) = 正本_tb.Text
- xlSheet.Cells(N2 + 2, 1) = "副本:" : xlSheet.Cells(N2 + 2, 2) = 副本_tb.Text : xlSheet.Cells(N2 + 2, 11) = 副本_tb.Text
-
- Else
- xlSheet.Cells(12, 1) = "正本:" : xlSheet.Cells(12, 2) = 正本_tb.Text : xlSheet.Cells(12, 11) = 正本_tb.Text
- xlSheet.Cells(13, 1) = "副本:" : xlSheet.Cells(13, 2) = 副本_tb.Text : xlSheet.Cells(13, 11) = 副本_tb.Text
- End If
-
- BB(xlApp, xlSheet)
-
- xlApp.Sheets(2).Delete : xlSheet.PageSetup.PrintArea = ""
- '----轉成PDF-----
- Dim pdfFolderPath As String = Path.Combine(System.Windows.Forms.Application.StartupPath, "pdf")
- If Not Directory.Exists(pdfFolderPath) Then
- Directory.CreateDirectory(pdfFolderPath)
- End If
- Dim pdfFilePath As String = Path.Combine(pdfFolderPath, 單號_tb.Text & "-公函.pdf")
- xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, pdfFilePath, XlFixedFormatQuality.xlQualityStandard, True)
- 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()
- Try
- Dim chromePath As String = "C:\Program Files\Google\Chrome\Application\chrome.exe"
- If System.IO.File.Exists(chromePath) Then
- Dim process As New Process()
- process.StartInfo.FileName = "chrome"
- process.StartInfo.Arguments = """" & pdfFilePath & """"
- process.Start()
- Else : Dim edgePath As String = "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
- If System.IO.File.Exists(edgePath) Then
- Dim process As New Process()
- process.StartInfo.FileName = "msedge"
- process.StartInfo.Arguments = """" & pdfFilePath & """"
- process.Start()
- Else
- Process.Start(pdfFilePath)
- End If
- End If
- Catch ex As Exception
- MsgBox("以存檔至桌面 。" & vbCrLf & "檔案名稱:" & 單號_tb.Text & "-公函.pdf")
- End Try
- End Sub
- Private Sub BB(ByVal myExcel As Microsoft.Office.Interop.Excel.Application, ByVal xlSheet As Microsoft.Office.Interop.Excel.Worksheet)
- xlSheet.Rows("1:1").Select
- With myExcel.Selection.Font
- .Name = "標楷體"
- .Size = 18
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontNone
- End With
- xlSheet.Range("2:4").Select()
-
- With myExcel.Selection.Font
- .Name = "標楷體"
- .Size = 10
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontNone
- End With
- If 說明_rtb.Text <> "" Then
- xlSheet.Range("6:10," & N2 + 1 & ":" & N2 + 2).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.Range("5:5,11:" & N2).Select()
-
- With myExcel.Selection.Font
- .Name = "標楷體"
- .Size = 16
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontNone
- End With
- Else
- xlSheet.Range("6:10,12:13").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.Range("5:5,11:11").Select()
-
- With myExcel.Selection.Font
- .Name = "標楷體"
- .Size = 16
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ThemeColor = xlThemeColorLight1
- .TintAndShade = 0
- .ThemeFont = xlThemeFontNone
- End With
- End If
-
- xlSheet.Columns("A:A").ColumnWidth = 5.5
- xlSheet.Columns("B:B").ColumnWidth = 1.5
- xlSheet.Columns("C:C").ColumnWidth = 2
- xlSheet.Columns("D:D").ColumnWidth = 0.38
- xlSheet.Columns("E:E").ColumnWidth = 5
- xlSheet.Columns("F:F").ColumnWidth = 41.5
- xlSheet.Columns("G:G").ColumnWidth = 8
- xlSheet.Columns("H:H").ColumnWidth = 10
- xlSheet.Columns("I:I").ColumnWidth = 8
- xlSheet.Columns("J:J").ColumnWidth = 10
-
-
-
- xlSheet.Range("A1:J1").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
-
- xlSheet.Range("H2:J2").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlCenter
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("G2,G3:J4").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlCenter
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
-
- xlSheet.Range("A5:D5").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("E5:J5").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
- xlSheet.Range("A6:C6").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("D6:J6").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
- xlSheet.Range("A7:C7").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("D7:J7").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("A8").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
-
- xlSheet.Range("B8:J8").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("A9:E9").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("F9:J9").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("A10").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
-
- xlSheet.Range("B10:J10").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("A11:B11").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("C11:J11").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
- If 說明_rtb.Text <> "" Then
- xlSheet.Range("A12:B12").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- For i = 12 To N2
- xlSheet.Range("C" & i & ":J" & i).Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
- Next
-
-
- xlSheet.Range("A" & N2 + 1).Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("B" & N2 + 1 & ":J" & N2 + 1).Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("A" & N2 + 2).Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("B" & N2 + 2 & ":J" & N2 + 2).Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
- Else
- xlSheet.Range("A12").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("B12:J12").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("A13").Select()
-
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = False
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
-
- xlSheet.Range("B13:J13").Select()
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
- myExcel.Selection.Merge
- End If
-
- xlSheet.Columns("K:K").Select
- With myExcel.Selection
- .HorizontalAlignment = xlLeft
- .VerticalAlignment = xlTop
- .WrapText = True
- .Orientation = 0
- .AddIndent = False
- .IndentLevel = 0
- .ShrinkToFit = False
- .ReadingOrder = xlContext
- .MergeCells = False
- End With
-
- xlSheet.Columns("K:K").ColumnWidth = 75.63
- xlSheet.Rows("5:5").Select
- xlSheet.Rows("5:5").EntireRow.AutoFit
-
-
- xlSheet.Columns("K:K").ColumnWidth = 70
- xlSheet.Rows("9:9").Select
- xlSheet.Rows("9:9").EntireRow.AutoFit
-
-
- xlSheet.Columns("K:K").ColumnWidth = 81
- xlSheet.Rows("8:8").Select
- xlSheet.Rows("8:8").EntireRow.AutoFit
- xlSheet.Rows("10:10").Select
- xlSheet.Rows("10:10").EntireRow.AutoFit
-
- If 說明_rtb.Text <> "" Then
- xlSheet.Rows(N2 + 1 & ":" & N2 + 1).Select
- xlSheet.Rows(N2 + 1 & ":" & N2 + 1).EntireRow.AutoFit
- xlSheet.Rows(N2 + 2 & ":" & N2 + 2).Select
- xlSheet.Rows(N2 + 2 & ":" & N2 + 2).EntireRow.AutoFit
-
- 'xlSheet.Columns("K:K").ColumnWidth = 73.8
- xlSheet.Columns("K:K").ColumnWidth = 88.8
- For i = 11 To N2
- xlSheet.Rows(i & ":" & i).Select
- xlSheet.Rows(i & ":" & i).EntireRow.AutoFit
- Next
-
- Else
- xlSheet.Rows("12:12").Select
- xlSheet.Rows("12:12").EntireRow.AutoFit
- xlSheet.Rows("13:13").Select
- xlSheet.Rows("13:13").EntireRow.AutoFit
-
- xlSheet.Columns("K:K").ColumnWidth = 88.8
- xlSheet.Rows("11:11").Select
- xlSheet.Rows("11:11").EntireRow.AutoFit
-
- End If
- xlSheet.Rows("6:6").Select
- xlSheet.Rows("6:6").EntireRow.AutoFit
- xlSheet.Rows("7:7").Select
- xlSheet.Rows("7:7").EntireRow.AutoFit
- xlSheet.Columns("K:K").Select
- myExcel.Selection.EntireColumn.Hidden = True
-
- For i = 1 To N2 + 2
- If xlSheet.Rows(i).RowHeight < 400 Then
- If i = 10 Or i = 11 Or i = N2 Then
- xlSheet.Rows(i).RowHeight = xlSheet.Rows(i).RowHeight + 8
- Else
- xlSheet.Rows(i).RowHeight = xlSheet.Rows(i).RowHeight + 5
- End If
- End If
- Next i
-
- myExcel.Application.PrintCommunication = False
- With myExcel.ActiveSheet.PageSetup
- .PrintTitleRows = ""
- .PrintTitleColumns = ""
- End With
- myExcel.Application.PrintCommunication = True
- myExcel.ActiveSheet.PageSetup.PrintArea = ""
- myExcel.Application.PrintCommunication = False
- With myExcel.ActiveSheet.PageSetup
- .LeftHeader = ""
- .CenterHeader = ""
- .RightHeader = ""
- .LeftFooter = ""
- .CenterFooter = ""
- .RightFooter = ""
- .LeftMargin = myExcel.Application.InchesToPoints(0.25)
- .RightMargin = myExcel.Application.InchesToPoints(0.25)
- .TopMargin = myExcel.Application.InchesToPoints(0.75)
- .BottomMargin = myExcel.Application.InchesToPoints(0.75)
- .HeaderMargin = myExcel.Application.InchesToPoints(0.3)
- .FooterMargin = myExcel.Application.InchesToPoints(0.3)
- .PrintHeadings = False
- .PrintGridlines = False
- .CenterHorizontally = False
- .CenterVertically = False
- .Draft = False
- .FirstPageNumber = xlAutomatic
- .BlackAndWhite = False
- .Zoom = False
- .FitToPagesWide = 1
- .FitToPagesTall = 0
- .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
- Private Shared Function NewMethod(xlBook As Microsoft.Office.Interop.Excel.Workbook) As Microsoft.Office.Interop.Excel.Worksheet
- Return CType(xlBook.Worksheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
- End Function
-
-
- End Class
|