[jacob]inserer image dans excel
Bonjour.
Je travaille avec jacob 1.17 sous eclipse.
J'ouvre un fichier excel pour y inserer des images.
Code:
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(); |
Il apparait l'erreur:
com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Add
Description: Paramètre non facultatif.
....
Que se passe t'il ?
D'avance merci.