用如下代码,把同一窗口生存的3个图表文件保存到电子表格中,很不清晰。
请教老师,如何修改代码,把3个图表文件先保存为WMF格式,再插入到自动保存到电子文件中。
Dim b As New XLS.Book
Dim t As Table = Tables("表D")
Dim s As XLS.Sheet = b.Sheets(0)
Dim Chart As WinForm.Chart = Forms("按科室统计").Controls("Chart1")
For c As Integer = 0 To t.Cols.Count -1 '添加列标题
s(0, c).Value = t.Cols(c).Name
Next
For r As Integer = 0 To t.Rows.Count - 1 '填入数据
For c As Integer = 0 To t.Cols.Count -1
s(r +1, c).Value = t.rows(r)(c)
Next
Next
此主题相关图片如下:360截图20180716192301232.jpg
's(t.rows.Count + 2,1).Value = New XLS.Picture(Chart.Image,0,0,422,258)
Dim Chart1 As WinForm.Chart = Forms("按科室统计").Controls("Chart1")
s(t.rows.Count + 2,1).Value = New XLS.Picture(Chart1.Image,0,0,422,258)
Dim Chart2 As WinForm.Chart = Forms("按科室统计").Controls("Chart2")
s(t.rows.Count + 20,1).Value = New XLS.Picture(Chart2.Image,0,0,422,258)
Dim Chart3 As WinForm.Chart = Forms("按科室统计").Controls("Chart3")
s(t.rows.Count + 40,1).Value = New XLS.Picture(Chart3.Image,0,0,422,258)
b.Save("c:\test.xls")
Dim Proc As New Process
Proc.File = "c:\test.xls"
Proc.Start()