日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

domino生成Excel图表

發(fā)布時(shí)間:2023/12/10 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 domino生成Excel图表 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

現(xiàn)在創(chuàng)建一個(gè)視圖操作名為 Generate Chart1,功能是統(tǒng)計(jì)各個(gè)年齡段(20 以下,20~29,30~39,40~49,50~59,60 及以上)的人數(shù)的百分比并以 Chart1.xls 為模板生成 Excel 餅圖,如果想生成不同的圖表,只需要將模板中的圖表格式類型改變并保存即可。代碼如下:

Sub Click(Source As Button)

????'定義一個(gè)數(shù)組來(lái)保存各個(gè)年齡段的人數(shù)

????Dim countArr(5) As Integer

????Dim s As New NotesSession

????Dim ws As New NotesUIWorkspace

????Dim db As NotesDatabase

????Set db = s.CurrentDatabase

????Dim vw As NotesView

????Set vw = db.GetView("ExcelTest")

????Dim doc As NotesDocument

????Set doc = vw.GetFirstDocument

????'計(jì)算各個(gè)年齡段人數(shù)

????While Not doc Is Nothing

????????age% = Cint(doc.Age(0))

????????If age%<20 Then

????????????countArr(0) = countArr(0) + 1

????????Elseif age%>=20 And age%<30 Then

????????????countArr(1) = countArr(1) + 1

????????Elseif age%>=30 And age%<40 Then

????????????countArr(2) = countArr(2) + 1

????????Elseif age%>=40 And age%<50 Then

????????????countArr(3) = countArr(3) + 1

????????Elseif age%>=50 And age%<60 Then

????????????countArr(4) = countArr(4) + 1

????????Else ???????????

????????????countArr(5) = countArr(5) + 1

????????End If

????????Set doc = vw.GetNextDocument(doc)

????Wend

????'生成Excel圖表

????Call generateExcelChart1(countArr, "C:\Chart1.xls")

????

????Dim uiChartDoc As NotesUIDocument

????Set uiChartDoc = ws.ComposeDocument( "", "", "Chart" )

????uiChartDoc.GotoField("Body")

????'將生成的Excel圖表粘貼到一個(gè)文檔中

????Call uiChartDoc.Paste

End Sub

?

其中生成 Excel 圖表的過(guò)程 generateExcelChart1() 代碼如下:

Sub generateExcelChart1(countArr As Variant, excelFileName As String)

????'定義Excel相關(guān)變量

????Dim excelApplication As Variant

????Dim excelWorkbook As Variant

????Dim excelSheet As Variant

????'創(chuàng)建Excel對(duì)象

????Set excelApplication = CreateObject("Excel.Application") ???

????'Excel程序設(shè)置為不可見(jiàn)

????excelApplication.Visible = False

????'打開(kāi)模版文件

????Set excelWorkbook = excelApplication.Workbooks.Open(excelFileName)

????Set excelSheet = excelWorkbook.Worksheets("Sheet1")

????'為圖表填充源數(shù)據(jù)

????excelSheet.Cells(2,2) = countArr(0)

????excelSheet.Cells(2,3) = countArr(1)

????excelSheet.Cells(2,4) = countArr(2)

????excelSheet.Cells(2,5) = countArr(3)

????excelSheet.Cells(2,6) = countArr(4)

????excelSheet.Cells(2,7) = countArr(5)

????'將生成的圖表復(fù)制到剪貼板

????excelSheet.ChartObjects(1).Chart.ChartArea.Copy

????'不保存退出Excel應(yīng)用程序

????excelWorkbook.Close False

????excelApplication.Quit

End Sub

??

?

?

?

總結(jié)

以上是生活随笔為你收集整理的domino生成Excel图表的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。