Dim wbr As WinForm.WebBrowser = e.Form.Controls("WebBrowser1")
Dim r As Row = Tables("表A").Current
Dim tmp As String = ProjectPath & "Attachments\cdsh2.xls"
Dim tmp1 As String = ProjectPath & "Attachments\cdsh.xls"
Dim rpt1 As String = "d:/tpcd/"+(Tables("表A").Current("第三列")) + (Tables("表A").Current("第四列")) +"01.xls"
Dim pdf As String = "d:/tpcd/temp/" & format(Date.now, "yyyyMMddHHmmss") & ".pdf"
Dim rpt As String = "d:/tpcd/"+(Tables("表A").Current("第三列")) + (Tables("表A").Current("第四列")) +"清单.xls"
FileSys.CreateDirectory("d:/tpcd/temp")
Dim Book As New XLS.Book(tmp)
Book.Build()
Book.Save(rpt) '保存为pdf文件
Dim Book1 As New XLS.Book(tmp1)
Book1.Build()
Book1.Save(rpt1)'保存为pdf文件
Dim App1 As New MSExcel.Application
Dim App2 As New MSExcel.Application
try
Dim Wb1 As MSExcel.WorkBook = App1.WorkBooks.Open(rpt1)
Dim Wb2 As MSExcel.WorkBook = App2.WorkBooks.Open(rpt)
Dim Ws1 As MSExcel.WorkSheet = Wb1.WorkSheets(1) '指定要复制的工作表
Dim Ws2 As MSExcel.WorkSheet = Wb2.WorkSheets(1)
Ws2.UsedRange.Copy
ws1.Select
'ws1.Cells(1,Ws1.UsedRange.Columns.Count).Select '横向拷贝
ws1.hPageBreaks.Add(ws1.Cells(Ws1.UsedRange.Rows.Count+1,1))
ws1.Cells(Ws1.UsedRange.Rows.Count+1,1).Select '纵向拷贝
ws1.paste
wb1.Save
wb2.Save
wb1.ExportAsFixedFormat(MSExcel.XlFixedFormatType.xlTypePDF, pdf, MsExcel.XlFixedFormatQuality.xlQualityStandard, True, False, System.Reflection.Missing.Value, System.Reflection.Missing.Value, True, System.Reflection.Missing.Value)
'app1.visible = True
app1.quit
app2.quit
catch ex As exception
msgbox(ex.message)
app1.quit
app2.quit
End try
wbr.AddRess = pdf