国产探花免费观看_亚洲丰满少妇自慰呻吟_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>



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

圖片精選

主站蜘蛛池模板: 扎囊县| 乡宁县| 井冈山市| 来安县| 建水县| 安顺市| 敖汉旗| 巴马| 邵阳市| 福建省| 普兰县| 聊城市| 固镇县| 敦化市| 高台县| 泰兴市| 九龙坡区| 迭部县| 正宁县| 山丹县| 娄底市| 武威市| 大渡口区| 上犹县| 凌源市| 托克逊县| 梁平县| 绩溪县| 策勒县| 海阳市| 明星| 开江县| 和静县| 呼和浩特市| 临朐县| 巴里| 汽车| 岳普湖县| 山阴县| 霍林郭勒市| 霞浦县|