i word with jacob 1.17 under Eclipse.
I open a file Excel and i try to insert images in it.
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
Dispatch xlo = (Dispatch) xl.getObject();
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();
But I have an error:
com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Add
Description: Parameter not optional.
did u ever try something like this ActiveSheet.Pictures.Insert("C:\Users\mo..")
in Excel's VBA ActiveSheet.Pictures.Add with 1 Parameter leads to this "Parameter not optional" runtimeError 449.
1. try in Excel
2. with a vbs-script
3. tranfer to jacob
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.