利用 printdocument控件
成都創(chuàng)新互聯(lián)公司服務項目包括浪卡子網(wǎng)站建設、浪卡子網(wǎng)站制作、浪卡子網(wǎng)頁制作以及浪卡子網(wǎng)絡營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關系等,向廣大中小型企業(yè)、政府機構等提供互聯(lián)網(wǎng)行業(yè)的解決方案,浪卡子網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務的客戶以成都為中心已經(jīng)輻射到浪卡子省份的部分城市,未來相信會繼續(xù)擴大服務區(qū)域并繼續(xù)獲得客戶的支持與信任!
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim stringFont As New Font("Arial", 16)
Dim rectDraw As New RectangleF(e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Width, e.MarginBounds.Height)
Dim strFormat As New StringFormat
Dim s As String
s = "print word" '打印的內(nèi)容
e.Graphics.DrawString(s, stringFont, Brushes.AliceBlue, rectDraw, strFormat)
End Sub
可以把數(shù)據(jù)導出到EXCEL,然后使用EXCEL進一步處理后使用。
也可以做成vb報表(VB自帶有)。
先設置報表格式,打印時向報表傳遞數(shù)據(jù)就可以了。
一般情況下先用EXCEL做好一個樣表文件,設定好打印區(qū)域和樣式,需要填內(nèi)容的時候,先程序復制一個樣表文件,然后調(diào)用API打開表格填寫內(nèi)容并打印,如果想用API來實現(xiàn)調(diào)整模板和打印預覽,可能比較困難,而且很抽象,個人覺得費時費力效果還不一定理想