试下这段
Dim Book As New XLS.Book(ProjectPath & "Attachments\模板-拆解参数.xls")
Dim fl As String = SpecialFolder.MyDocuments & "\Reports\拆解规范\" & format(Date.Today(),"yyyy-MM-dd") & " 拆解参数.xls"
StatusBar.Message2 = "已生成出库单,保存在【我的文档】下Roports\拆解规范 文件夹,文件名为:" & format(Date.Today(),"yyyy-MM-dd") & " 拆解参数.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl)
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Ws.PageSetup.PrintTitleRows = "$1:$3" '打印行标题(在每一页的顶部重复出现,指定第1到3行为行标题)
App.Visible = True
Ws.PrintPreview
App.Quit
使用时修改模板表名
[此贴子已经被作者于2013-1-25 10:56:00编辑过]