各位老师好!如题!
以下是我生成报表的代码,我想实现点击“生成日报”按钮后,自动生成新邮件并将报表复制到邮件的正文中,但是不直接发送。
谢谢!
Dim Result As DialogResult
Result = MessageBox.Show(" 工作时间是否正确?","提示",MessageBoxButtons.YesNo)
If Result = DialogResult.Yes Then
Dim Book As New XLS.Book(ProjectPath & "Attachments\日报.xls")
Dim fl As String = ProjectPath & "Reports\日报.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(2,9).Value = "<填写时间 = #"& date.today &"#>" '写入打印条件
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(ProjectPath & "reports\日报.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Cells
'Rg.EntireColumn.AutoFit '自动调整列宽
Rg.EntireRow.AutoFit '自动调整行高
'Rg.WrapText = True
App.Visible = True
End If