看看下面的例子<HTML>
<BODY><INPUT id=button1 name=button1 type=button value=点击测试><SCRIPT LANGUAGE="VBScript"> sub button1_onclick()
dim app
set app = createobject("Excel.Application")
app.Visible = true
dim wb
set wb = app.workbooks.add
dim arr(19,9)
for i = 1 to 20
for j = 1 to 10
arr(i-1,j-1) = i*j
next
next
dim rng
set rng = wb.Activesheet.Range("A1").Resize(20,10)
rng.value = arr
wb.Charts.Add
wb.ActiveChart.ChartType = 70 'xl3dPieExploded
wb.ActiveChart.SetSourceData rng, 2 ' xlColumns
wb.ActiveChart.Location 2, "Sheet1" 'xlLocationAsObject
for i = 1 to 360 step 30
wb.activechart.rotation = i
next
app.UserControl = true end sub
</SCRIPT></BODY>
</HTML>
<BODY><INPUT id=button1 name=button1 type=button value=点击测试><SCRIPT LANGUAGE="VBScript"> sub button1_onclick()
dim app
set app = createobject("Excel.Application")
app.Visible = true
dim wb
set wb = app.workbooks.add
dim arr(19,9)
for i = 1 to 20
for j = 1 to 10
arr(i-1,j-1) = i*j
next
next
dim rng
set rng = wb.Activesheet.Range("A1").Resize(20,10)
rng.value = arr
wb.Charts.Add
wb.ActiveChart.ChartType = 70 'xl3dPieExploded
wb.ActiveChart.SetSourceData rng, 2 ' xlColumns
wb.ActiveChart.Location 2, "Sheet1" 'xlLocationAsObject
for i = 1 to 360 step 30
wb.activechart.rotation = i
next
app.UserControl = true end sub
</SCRIPT></BODY>
</HTML>
<p><input type='button' value='打印' name='B1' onclick="javascript:OpenExcel('http://127.0.0.1/Gradmin/print/ysjytj.xls')"></p>
要用到期ActiveX控件。
在Front Page 中有提供。