In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "VB.NET how to operate Excel", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "VB.NET how to operate Excel" this article.
VB.NET operation Excel code
Public Sub Printer () Sub Printer
(ByVal pid As Int16, ByVal dbhlp
As DBHelper, ByVal objds As ploy)
Dim sqlstr As String
Sqlstr = "select * from Ploy"
Where ployID= "& pid
Dbhlp.FillDataTable (sqlstr
Objds, "Ploy")
Sqlstr = "select * from PForeign"
Where ployID= "& pid
Dbhlp.FillDataTable (sqlstr
Objds, "PForeign")
Dim exl As New Excel.Application
Exl.Visible = True
Exl.DisplayAlerts = True
Exl.WindowState = Excel.XlWindow
State.xlMaximized
'Dim wb As Excel.Workbook =
Exl.Workbooks.Open (Application.
StartupPath & "\ print.xls")
'Dim ws As Excel.Worksheet =
Wb.Worksheets ("prt")
Dim wb As Excel.Workbook =
Exl.Workbooks.Add ()
Dim ws As Excel.Worksheet =
Wb.Worksheets.Item (1)
Dim Rng As Excel.Range
Rng = ws.Columns (1)
Rng.ColumnWidth = 16
Rng = ws.Columns (2)
Rng.ColumnWidth = 46
Rng = ws.Columns (3)
Rng.ColumnWidth = 16
Dim dr As ploy.PloyRow
Dr = objds.Ploy.Rows (0)
Try
Rng = ws.Range ("A1:A1", "C1:C1")
Rng.Cells.Merge () 'merge cells
Rng.Font.Name = "boldface"
Rng.Font.Size = "22"
Rng.HorizontalAlignment =-4108
Rng.VerticalAlignment =-4108
Rng.Value = dr.PSubject
Catch ex As Exception
End Try
Try Rng = ws.Range ("A2:A2", "C2:C2") Rng.Cells.Merge () Rng.Font.Name = "boldface" Rng.Font.Size = "14" Rng.HorizontalAlignment =-4108 Rng.VerticalAlignment =-4108 Rng.Value = "time:" & dr.PTime Catch ex As Exception End TryTry Rng = ws.Range ("A3:A3" "C3:C3") Rng.Cells.Merge () Rng.Font.Name = "boldface" Rng.Font.Size = "14" Rng.HorizontalAlignment =-4108 Rng.VerticalAlignment =-4108 Rng.Value = "location:" & dr.Place Catch ex As Exception End Try
Dim drF As ploy.PForeignRow
Dim i, rngi As Integer
Dim rngs, cellB, cellE As String
Rngi = 5 + objds.PForeign.Rows.Count
CellB = "A5:A5"
CellE = "C" & rngi.ToString &
": C" & rngi.ToString
Rng = ws.Range (cellB, cellE)
Rng.Font.Name = "imitating Song _ GB2312"
Rng.Font.Size = "16"
Rng.Borders.LineStyle = 1
Rng.HorizontalAlignment =-4108
Rng.VerticalAlignment =-4108
Rng = ws.Range ("A5")
Rng.Value = "Consulate"
Rng = ws.Range ("B5")
Rng.Value = "attendees"
Rng = ws.Range ("C5")
Rng.Value = "title"
Rngi = 6
For I = 0 To objds.PForeign.
Rows.Count-1
DrF = objds.PForeign.Rows (I)
Rng = ws.Range ("A" & rngi.ToString)
Rng.Value = drF.PConsulate
Rng = ws.Range ("B" & rngi.ToString)
Rng.Value = drF.PName
Rng = ws.Range ("C" & rngi.ToString)
Rng.Value = drF.PRank
Rngirngi = rngi + 1
Next
'wb.Save ()
'If Not exl Is Nothing Then
'exl.Workbooks.Close ()
'exl.Quit ()
'System.Runtime.InteropServices.
Marshal.ReleaseComObject (exl)
'End If
'If Not ws Is Nothing Then
'System.Runtime.InteropServices.
Marshal.ReleaseComObject (ws)
'End If
'ws = Nothing
'exl = Nothing
'GC.Collect ()
End Sub
End Class
The above is all the contents of the article "how VB.NET operates Excel". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un