jacob 获取word文件中嵌入的excel图表,并给图表设置数据源
我做了一个word模板,还嵌入了一个excel图表,怎么用jacob把图表数据set进去,
--------------------编程问答--------------------
自己解决,贴出部分代码
Dispatch shapes = Dispatch.get(document,"InLineShapes").toDispatch();
Dispatch shape = Dispatch.call(shapes,"Item",new Variant(0)).toDispatch();
Dispatch oneo = Dispatch.get(shape,"OLEFormat").toDispatch();
String classType = Dispatch.get(oneo,"ClassType").toString();
if("Excel.Chart.8".equals(classType)){
Dispatch.call(oneo,"Open");
Dispatch obj = Dispatch.get(oneo,"Object").toDispatch();
Dispatch sheets = Dispatch.get(obj,"Sheets").toDispatch();
Dispatch sheet = Dispatch.invoke(sheets,"Item",Dispatch.Get,new Object[]{new String("Sheet1")},new int[1]).toDispatch();
Dispatch cell = Dispatch.invoke(sheet,"Range",Dispatch.Get,new object[]{"A1"},new int[1]).toDispatch();
Dispatch.put(cell,"Value","100");
}
--------------------编程问答--------------------
http://topic.csdn.net/u/20110609/11/c5eebaa0-c7ee-49e7-814e-b483d2f6882d.html?47514
--------------------编程问答--------------------
楼主是怎么解决的啊,求分享
补充:VB , VBA