以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 多图表同时保存问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=121928) |
-- 作者:HJG_HB950207 -- 发布时间:2018/7/16 8:31:00 -- 多图表同时保存问题 在窗口1中有职工表 根据职工表生存3个图表 CHART1,CHART2,CHART3 请教:如何将职工表和3个图表导出到同一个电子表格文件中(不是导到不同的文件)。 Dim b As New XLS.Book Dim t As Table = Tables("职工表") Dim s As XLS.Sheet = b.Sheets(0) Dim Chart As WinForm.Chart = Forms("窗口1").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 s(t.rows.Count + 2,1).Value = New XLS.Picture(Chart.Image,0,0,422,258) b.Save("c:\\test.xls") Dim Proc As New Process Proc.File = "c:\\test.xls" Proc.Start() |
-- 作者:有点甜 -- 发布时间:2018/7/16 8:48:00 -- 这句代码,写3个不就可以了?
Dim Chart1 As WinForm.Chart = Forms("窗口1").Controls("Chart1") s(t.rows.Count + 2,1).Value = New XLS.Picture(Chart1.Image,0,0,422,258)
Dim Chart2 As WinForm.Chart = Forms("窗口1").Controls("Chart2") s(t.rows.Count + 20,1).Value = New XLS.Picture(Chart2.Image,0,0,422,258)
Dim Chart3 As WinForm.Chart = Forms("窗口1").Controls("Chart3") s(t.rows.Count + 40,1).Value = New XLS.Picture(Chart3.Image,0,0,422,258) [此贴子已经被作者于2018/7/16 8:48:52编辑过]
|