Dim Book As New XLS.Book(ProjectPath & "Attachments\水电费结算单.xlsx") '打开模板
Dim fl As String = ProjectPath & "Reports\水电费结算单.pdf"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim str1 As Integer = e.Form.Controls("ComboBox1").Value '选年份
Dim str2 As Integer = e.Form.Controls("ComboBox2").Value '选月份
Dim str3 As String = e.Form.Controls("ComboBox3").Value '选单位
Dim Filter As String = "[yy] = " & str1 & " and [yy1] = " & str2 & " and [khbh] = '" & str3 & "'"
If Filter IsNot Nothing Then
Dim dr2 As Double = DataTables("wy_cpd").Compute("Sum(jsje)", Filter)
Dim dr3 As Double = DataTables("wy_dgt").Compute("Sum(tje)", Filter)
Dim dr4 As Double = DataTables("wy_dgd").Compute("Sum(je)", Filter)
Dim dr5 As Double = DataTables("wy_cps").Compute("Sum(jsje)", Filter)
Dim dr6 As Double = DataTables("wy_sgt").Compute("Sum(tje)", Filter)
Dim dr7 As Double = DataTables("wy_sgd").Compute("Sum(je)", Filter)
Dim dr8 As Double = DataTables("wy_wgd").Compute("Sum(je)", Filter)
Sheet(7,10).Value = dr2+dr3+dr4 '写年
Sheet(11,10).Value = dr5+dr6+dr7 '写年
Sheet(13,10).Value = dr8 '写年
Sheet(14,10).Value = dr2+dr3+dr4+dr5+dr6+dr7+dr8 '写年
Sheet(2,8).Value = str1 & "年"& str2 & "月" '写年
End If
Sheet(4,11).Value = "< yy = " & str1 & " and yy1 = " & str2 & ">" '写年
Sheet(5,11).Value = "< yy = " & str1 & " and yy1 = " & str2 & ">" '写年
Sheet(6,11).Value = "< yy = " & str1 & " and yy1 = " & str2 & ">" '写年
Sheet(8,11).Value = "< yy = " & str1 & " and yy1 = " & str2 & ">" '写年
Sheet(9,11).Value = "< yy = " & str1 & " and yy1 = " & str2 & ">" '写年
Sheet(10,11).Value = "< yy = " & str1 & " and yy1 = " & str2 & ">" '写年
Sheet(12,11).Value = "< yy = " & str1 & " and yy1 = " & str2 & ">" '写年
Book.Build() '生成报表
Book.SaveToPDF(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()
老师 以上代码是否有错?发布后打印PDF时, 提示:无法保存该文档。该文档可能已被打开,或者保存时出错! 确定后又提示 异常来自 HRESULT:0x800A03EC
在没有发布开发时,运行正常。发布后就有问题。我是在同一台电脑开发,并运行的
[此贴子已经被作者于2020/6/5 14:34:00编辑过]