以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 当前副本表不能循环打印 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=116117) |
-- 作者:ryubo888 -- 发布时间:2018/3/20 10:49:00 -- 当前副本表不能循环打印 For Each dr As Row In CurrentTable.rows() Dim Book1 As New XLS.Book(ProjectPath & "Attachments\\单人登记表.xls") Dim file1 As String = ProjectPath & "Reports\\单人登记表.xls" Book1.Build() \'生成细节区 Book1.Save(file1) \'保存工作簿 Dim App As New MSExcel.Application Dim Wb As MSExcel.WorkBook try wb = App.WorkBooks.Open(file1) Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1) With Ws.PageSetup .PaperSize = MSExcel.XlPaperSize.xlPaperA4 \'纸张大小 \' .CenterHorizontally = True \'页面水平居中 \' .CenterVertically = True \'页面垂直居中 \' .Zoom = False \'以下设置将缩印在一页内 .FitToPagesWide = 1 \'按照1页的宽度打印 .FitToPagesTall = 1 \'按照1页的高度打印 End With \'App.Visible = True Ws.PrintOut catch ex As exception msgbox("出错了") finally wb.save wb.close App.Quit End try Next 上面代码错哪了,不能按当前记录循环打印,总打第一条记录。
[此贴子已经被作者于2018/3/20 10:56:20编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/3/20 11:02:00 -- For Each dr As Row In CurrentTable.rows() CurrentTable.Position = dr.index Dim Book1 As New XLS.Book(ProjectPath & "Attachments\\单人登记表.xls")
Dim file1 As String = ProjectPath & "Reports\\单人登记表.xls"
Book1.Build() \'生成细节区
Book1.Save(file1) \'保存工作簿
|