圖表 現在我們針對EXCEL舉另外一個例子,大家都詢問如何用ASP建立圖表的問題,以下就是解決方案<BR><BR>First we set the type of script<BR>首先設定指令碼類型<BR><%@ LANGUAGE="VBSCRIPT" %><BR><BR>Make the object, and set the object to an Excelsheet<BR>建立Excelsheet對象<BR><BR>Dim MyExcelChart<BR>Set MyExcelChart = CreateObject("Excel.Sheet")<BR><BR>' show or dont show excel to user, TRUE or FALSE<BR>是否讓使用者看到EXCEL表格,真或假<BR>MyExcelChart.Application.Visible = True<BR><BR>' populate the cells<BR>添EXCEL表格<BR>MyExcelChart.ActiveSheet.Range("B2:k2").Value = Array("Week1", "Week2", "Week3", "Week4", "Week5", "Week6", "Week7", "Week8", "Week9", "Week10")<BR>MyExcelChart.ActiveSheet.Range("B3:k3").Value = Array("67", "87", "5", "9", "7", "45", "45", "54", "54", "10")<BR>MyExcelChart.ActiveSheet.Range("B4:k4").Value = Array("10", "10", "8", "27", "33", "37", "50", "54", "10", "10")<BR>MyExcelChart.ActiveSheet.Range("B5:k5").Value = Array("23", "3", "86", "64", "60", "18", "5", "1", "36", "80")<BR>MyExcelChart.ActiveSheet.Cells(3,1).Value="Internet Explorer"<BR>MyExcelChart.ActiveSheet.Cells(4,1).Value="Netscape"<BR>MyExcelChart.ActiveSheet.Cells(5,1).Value="Other"<BR><BR>' Select the contents that need to be in the chart<BR>在EXCEL表中選擇要在圖表(CHART)中顯示的資料<BR>MyExcelChart.ActiveSheet.Range("b2:k5").Select<BR><BR>' Add the chart<BR>載入圖表(CHART)<BR>MyExcelChart.Charts.Add<BR>' Format the chart, set type of chart, shape of the bars, show title, get the data for the chart, show datatable, show legend<BR>初始化圖表(CHART),設定圖表類型,棒圖的形狀,要顯示的標題,取得要作圖的資料,顯示資料表,顯示圖表<BR>MyExcelChart.activechart.ChartType = 97<BR>MyExcelChart.activechart.BarShape =3<BR>MyExcelChart.activechart.HasTitle = True<BR>MyExcelChart.activechart.ChartTitle.Text = "Visitors log for each week shown in browsers percentage"<BR>MyExcelChart.activechart.SetSourceData MyExcelChart.Sheets("Sheet1").Range("A1:k5"),1<BR>MyExcelChart.activechart.Location 1<BR>MyExcelChart.activechart.HasDataTable = True<BR>MyExcelChart.activechart.DataTable.ShowLegendKey = True<BR><BR>' Save the the excelsheet to excelface<BR>存入EXCEL表<BR>MyExcelChart.SaveAs "c:\chart.xls"<BR>%><BR><BR>Now lets complete the HTML tags.<BR>下面是HTML代碼<BR><BR><HTML><BR><HEAD><BR><TITLE>MyExcelChart</TITLE><BR></HEAD><BR><BODY><BR></BODY><BR></HTML><BR><BR>This completes yer ASP page, look below for the complete code of myexcelchart.asp<BR>下面是來源程式myexcelchart.asp的完整代碼<BR><BR><%@ LANGUAGE="VBSCRIPT" %><BR><%<BR>Set MyExcelChart = CreateObject("Excel.Sheet")<BR><BR>MyExcelChart.Application.Visible = True<BR><BR>MyExcelChart.ActiveSheet.Range("B2:k2").Value = Array("Week1", "Week2", "Week3", "Week4", "Week5", "Week6", "Week7", "Week8", "Week9", "Week10")<BR>MyExcelChart.ActiveSheet.Range("B3:k3").Value = Array("67", "87", "5", "9", "7", "45", "45", "54", "54", "10")<BR>MyExcelChart.ActiveSheet.Range("B4:k4").Value = Array("10", "10", "8", "27", "33", "37", "50", "54", "10", "10")<BR>MyExcelChart.ActiveSheet.Range("B5:k5").Value = Array("23", "3", "86", "64", "60", "18", "5", "1", "36", "80")<BR>MyExcelChart.ActiveSheet.Cells(3,1).Value="Internet Explorer"<BR>MyExcelChart.ActiveSheet.Cells(4,1).Value="Netscape"<BR>MyExcelChart.ActiveSheet.Cells(5,1).Value="Other"<BR><BR>MyExcelChart.ActiveSheet.Range("b2:k5").Select<BR><BR>MyExcelChart.Charts.Add<BR>MyExcelChart.activechart.ChartType = 97<BR>MyExcelChart.activechart.BarShape =3<BR>MyExcelChart.activechart.HasTitle = True<BR>MyExcelChart.activechart.ChartTitle.Text = "Visitors log for each week shown in browsers percentage"<BR>MyExcelChart.activechart.SetSourceData MyExcelChart.Sheets(&<br><CENTER></CENTER>