jacob直接操作Excel图表函数

时间:2017-01-22 07:02:18
【文件属性】:

文件名称:jacob直接操作Excel图表函数

文件大小:413KB

文件格式:RAR

更新时间:2017-01-22 07:02:18

Excel 图表

一个简单示例 初始化当前Java线程STA ComThread InitSTA ; ActiveXComponent xl new ActiveXComponent "Excel Application" ; try{ 打开现有的Excel xl setProperty "Visible" new Variant false ; Dispatch workbooks xl getProperty "Workbooks" toDispatch ; Dispatch workbook Dispatch invoke workbooks "Open" Dispatch Method new Object[]{excelPath new Variant false 是否只读 new Variant false } 是否显示打开 new int[1] toDispatch ; 得到所有sheet Dispatch sheets Dispatch get workbook "sheets" toDispatch ; System out println "sheet数量:"+Dispatch get sheets "count" toString ; 根据索引得到sheet Dispatch sheet Dispatch invoke sheets "Item" Dispatch Get new Object[]{i} new int[1] toDispatch ; 绘图 Dispatch chartobjects Dispatch call sheet "ChartObjects" toDispatch ; Dispatch achart Dispatch invoke chartobjects "Add" Dispatch Method new Object[] { new Double 12 yHeight 横坐标 纵坐标 new Double 943 new Double 293 宽度 高度 } new int[1] toDispatch ; Dispatch chart Dispatch get achart "chart" toDispatch ; Dispatch range Dispatch invoke sheet "Range" Dispatch Get new Object[] {rangeX rangeY} 列名位置 数据位置 new int[2] toDispatch ; Dispatch series Dispatch call chart "seriescollection" toDispatch ; Dispatch call series "add" range new Variant true ; 生成图形 Dispatch put chart "PlotBy" "2" ; 纵向读取数据绘制chart 设置线条气泡颜色 黄色 Dispatch seriesChartFillFormat Dispatch get series "Fill" toDispatch ; Dispatch seriesForeColor Dispatch get seriesChartFillFormat "ForeColor" toDispatch ; Dispatch put seriesForeColor "SchemeColor" "18" ; 设置绘图区背景色为透明 Dispatch plotArea Dispatch get chart "PlotArea" toDispatch ; Dispatch plotAreaInterior Dispatch get plotArea "Interior" toDispatch ; Dispatch put plotAreaInterior "ColorIndex" " 4142" ; 设置标题 Dispatch chartTitle Dispatch get chart "ChartTitle" toDispatch ; Dispatch put chartTitle "Text" params[paramIndex][0] ; 设置图例位置 Dispatch legend Dispatch get chart "Legend" toDispatch ; Dispatch put legend "Position" " 4160" ; 设置图表背景色 Dispatch chartArea Dispatch get chart "ChartArea" toDispatch ; Dispatch chartFillFormat Dispatch get chartArea "Fill" toDispatch ; Dispatch fc Dispatch get chartFillFormat "ForeColor" toDispatch ; Dispatch put fc "SchemeColor" "35" ; 保存 Dispatch call workbook "Save" ; Dispatch call workbook "Close" new Variant false ; xl invoke "Quit" new Variant[] {} ; }catch Exception ex { ex printStackTrace ; } finally { 释放 com 资源 xl invoke "Quit" new Variant[] {} ; ComThread Release ; System out println " 处理完成 " ; }">一个简单示例 初始化当前Java线程STA ComThread InitSTA ; ActiveXComponent xl new ActiveXComponent "Excel Application" ; try{ 打开现有的Excel xl setProperty "Visible" new Variant false ; Dispatch workbooks xl getProperty "Workbooks" toDis [更多]


【文件预览】:
jacob-1.17-M2
----README.txt(519B)
----jacob-1.17-M2-x86.dll(172KB)
----docs()
--------api()
--------ReleaseNotes.html(45KB)
--------JacobComLifetime.html(3KB)
--------UsingJacob.html(12KB)
--------JacobThreading.html(14KB)
--------EventCallbacks.html(6KB)
--------BuildingJacobFromSource.html(6KB)
----jacob-1.17-M2-x64.dll(213KB)
----LICENSE.TXT(26KB)
----jacob.jar(47KB)

网友评论

  • 上当了,这个是1.17的包。。。
  • 我为什么下载下来是个jacob的包啊,没有想要看的内容啊,这也太假了吧
  • 主体是下载的包还是你上面引用的api啊,倒是给指明了几个功能,下载下来得就是jacob包和dll嘛,如果有excel生成柱状图的例子就更好了。
  • 有很多可借鉴的