国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

如何用ASP建立圖表

2019-11-18 22:05:40
字體:
來源:轉載
供稿:網友
現在我們針對Excel舉另外一個例子,大家都詢問如何用asp建立圖表的問題,以下就是解決方案

First we set the type of script
首先設定腳本類型
<%@ LANGUAGE="VBSCRIPT" %>

Make the object, and set the object to an Excelsheet
建立Excelsheet對象

Dim MyExcelChart
Set MyExcelChart = CreateObject("Excel.Sheet")

' show or dont show excel to user, TRUE or FALSE
是否讓用戶看到EXCEL表格,真或假
MyExcelChart.application.Visible = True

' populate the cells
添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="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
在EXCEL表中選擇要在圖表(CHART)中顯示的數據
MyExcelChart.ActiveSheet.Range("b2:k5").Select
   
' Add the chart
加載圖表(CHART)
MyExcelChart.Charts.Add
' Format the chart, set type of chart, shape of the bars, show title, get the data for the chart, show datatable, show legend
初始化圖表(CHART),設定圖表類型,棒圖的形狀,要顯示的標題,取得要作圖的數據,顯示數據表,顯示圖表
MyExcelChart.activechart.ChartType = 97
MyExcelChart.activechart.BarShape =3
MyExcelChart.activechart.HasTitle = True
MyExcelChart.activechart.ChartTitle.Text = "Visitors log for each week shown in browsers percentage"
MyExcelChart.activechart.SetSourceData MyExcelChart.Sheets("Sheet1").Range("A1:k5"),1
MyExcelChart.activechart.Location 1
MyExcelChart.activechart.HasDataTable = True
MyExcelChart.activechart.DataTable.ShowLegendKey = True

' Save the the excelsheet to excelface
存入EXCEL表
MyExcelChart.SaveAs "c:/chart.xls"
%>

Now lets complete the HTML tags.
下面是HTML代碼

<HTML>
<HEAD>
<TITLE>MyExcelChart</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>

This completes yer ASP page, look below for the complete code of myexcelchart.asp
下面是源程序myexcelchart.asp的完整代碼

<%@ LANGUAGE="VBSCRIPT" %>
<%
Set MyExcelChart = 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="Internet Explorer"
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 = "Visitors log for each week shown in browsers percentage"
MyExcelChart.activechart.SetSourceData MyExcelChart.Sheets("Sheet1").Range("A1:k5"),1
MyExcelChart.activechart.Location 1
MyExcelChart.activechart.HasDataTable = True
MyExcelChart.activechart.DataTable.ShowLegendKey = True

MyExcelChart.SaveAs "c:/chart.xls"

%>
<HTML>
<HEAD>
<TITLE>MyExcelChart</TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 班戈县| 开远市| 华坪县| 芜湖县| 扬中市| 郯城县| 连城县| 宝兴县| 武汉市| 屏东县| 宜兰市| 保山市| 本溪市| 合江县| 定兴县| 茂名市| 微博| 许昌市| 彝良县| 潜山县| 西乌珠穆沁旗| 咸阳市| 武宁县| 贺兰县| 上栗县| 南雄市| 略阳县| 元朗区| 拜城县| 高阳县| 比如县| 铜梁县| 金沙县| 弥勒县| 曲阜市| 兴宁市| 阳新县| 小金县| 清苑县| 水城县| 兰溪市|