1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
Dispatch xlo = (Dispatch) xl.getObject();
try {
System.out.println("version="+xl.getProperty("Version"));
System.out.println("version="+Dispatch.get(xlo, "Version"));
xl.setProperty("Visible", new Variant(true));
//
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
//
File file=new File("\\...\\Trombi.xls");
Dispatch workBook = Dispatch.call(workbooks, "Open", file.getAbsolutePath()).toDispatch();
Dispatch sheet = Dispatch.get(workBook,"ActiveSheet").toDispatch();
Dispatch pictures = Dispatch.get(sheet, "Pictures").toDispatch();
Dispatch newPicture = Dispatch.call(pictures, "Add", "...\monimage.jpg").toDispatch(); |
Partager