|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
由于ASP提供的是一对多的服务,所以用户的一些特殊需求很难得到满足。excel|图表|excel|图表如今我们针对EXCEL举别的一个例子,人人都扣问怎样用ASP创建图表的成绩,以下就是办理计划
Firstwesetthetypeofscript
起首设定剧本范例
<%@LANGUAGE="VBSCRIPT"%>
Maketheobject,andsettheobjecttoanExcelsheet
创建Excelsheet工具
DimMyExcelChart
SetMyExcelChart=CreateObject("Excel.Sheet")
showordontshowexceltouser,TRUEorFALSE
是不是让用户看到EXCEL表格,真或假
MyExcelChart.Application.Visible=True
populatethecells
添EXCEL表格
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="InternetExplorer"
MyExcelChart.ActiveSheet.Cells(4,1).Value="Netscape"
MyExcelChart.ActiveSheet.Cells(5,1).Value="Other"
Selectthecontentsthatneedtobeinthechart
在EXCEL表当选摘要在图表(CHART)中显现的数据
MyExcelChart.ActiveSheet.Range("b2:k5").Select
Addthechart
加载图表(CHART)
MyExcelChart.Charts.Add
Formatthechart,settypeofchart,shapeofthebars,showtitle,getthedataforthechart,showdatatable,showlegend
初始化图表(CHART),设定图表范例,棒图的外形,要显现的题目,获得要作图的数据,显现数据表,显现图表
MyExcelChart.activechart.ChartType=97
MyExcelChart.activechart.BarShape=3
MyExcelChart.activechart.HasTitle=True
MyExcelChart.activechart.ChartTitle.Text="Visitorslogforeachweekshowninbrowserspercentage"
MyExcelChart.activechart.SetSourceDataMyExcelChart.Sheets("Sheet1").Range("A1:k5"),1
MyExcelChart.activechart.Location1
MyExcelChart.activechart.HasDataTable=True
MyExcelChart.activechart.DataTable.ShowLegendKey=True
Savethetheexcelsheettoexcelface
存进EXCEL表
MyExcelChart.SaveAs"c:chart.xls"
%>
NowletscompletetheHTMLtags.
上面是HTML代码
<HTML>
<HEAD>
<TITLE>MyExcelChart</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
ThiscompletesyerASPpage,lookbelowforthecompletecodeofmyexcelchart.asp
上面是源程序myexcelchart.asp的完全代码
<%@LANGUAGE="VBSCRIPT"%>
<%
SetMyExcelChart=CreateObject("Excel.Sheet")
MyExcelChart.Application.Visible=True
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="InternetExplorer"
MyExcelChart.ActiveSheet.Cells(4,1).Value="Netscape"
MyExcelChart.ActiveSheet.Cells(5,1).Value="Other"
MyExcelChart.ActiveSheet.Range("b2:k5").Select
MyExcelChart.Charts.Add
MyExcelChart.activechart.ChartType=97
MyExcelChart.activechart.BarShape=3
MyExcelChart.activechart.HasTitle=True
MyExcelChart.activechart.ChartTitle.Text="Visitorslogforeachweekshowninbrowserspercentage"
MyExcelChart.activechart.SetSourceDataMyExcelChart.Sheets("Sheet1").Range("A1:k5"),1
MyExcelChart.activechart.Location1
MyExcelChart.activechart.HasDataTable=True
MyExcelChart.activechart.DataTable.ShowLegendKey=True
MyExcelChart.SaveAs"c:chart.xls"
%>
<HTML>
<HEAD>
<TITLE>MyExcelChart</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML></p>对用户来说可预见费用、节约费用,可以做到花少钱办大事。由于省去了购买软件和硬件等的前期费用,用户可以租用较高级的应用软件。ASP的收费是根据软件的类型、客制化程度、用户数量、服务期限来定的,对客户来说这笔费用是可以预见的。方便于客户应用软件的升级。 |
|