Image

返回生成的图片,Image类型。

示例

打开示例文件“Excel报表.Table”,然后选择“统计表”,可以看到下面的窗口:

窗口中有一个“生成Excel报表”按钮,其Click事件代码如下:

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:\reports\test.xls")

Dim
Proc As New Process
Proc.File =
"c:\reports\test.xls"
Proc.Start()

单击该按钮,生成下图所示的Excel报表,报表中插入了Chart空间生成的图表:


本页地址:http://www.foxtable.com/webhelp/topics/1475.htm