asp与电子表格excel_ASP与电子表格EXCEL的交互操作

更新时间:2013-12-14    来源:excel    手机版     字体:

【www.bbyears.com--excel】

Here we go again with another sample for Excel, this time we will be using ASP to create a chart. You all
asked me for it, now here is the solution. Thanks again for all your nice comments :)
First we set the type of script
<%@ LANGUAGE="VBSCRIPT" %>
Make the object, and set the object to an Excelsheet
Dim MyExcelChart
Set MyExcelChart = CreateObject("Excel.Sheet")
Now lets write the rest of the script, see the comments
" show or dont show excel to user, TRUE or FALSE
MyExcelChart.Application.Visible = True
" populate the cells
MyExcelChart.ActiveSheet.Range("B2:k2").Value = Array
("Week1", "Week2", "Week3", "Week4", "Week5", "Week6", "Week7", "Week8", "Week9", "Week10")
MyExcelChart.ActiveSheet.Range("B3:k3").Value = Array
("67", "87", "5", "9", "7", "45", "45", "54", "54", "10")
MyExcelChart.ActiveSheet.Range("B4:k4").Value = Array
("10", "10", "8", "27", "33", "37", "50", "54", "10", "10")
MyExcelChart.ActiveSheet.Range("B5:k5").Value = Array
("23", "3", "86", "64", "60", "18", "5", "1", "36", "80")
MyExcelChart.ActiveSheet.Cells(3,1).Value="Internet Explorer"
MyExcelChart.ActiveSheet.Cells(4,1).Value="Netscape"
MyExcelChart.ActiveSheet.Cells(5,1).Value="Other"
" Select the contents that need to be in the chart
MyExcelChart.ActiveSheet.Range("b2:k5").Select

" Add the chart
MyExcelChart.Charts.Add
" Format the chart, set type of chart, shape of the bars, show title, get the data for the chart, show

本文来源:http://www.bbyears.com/bangongshuma/2704.html

猜你感兴趣

热门标签

更多>>

本类排行