This discussion is archived
3 Replies Latest reply: Dec 2, 2009 2:01 AM by 843804 RSS

Changing font in MSWord with JACOB

843804 Newbie
Currently Being Moderated
I am trying to create a word document from within a java app.. All I want to do is change the font to Arial (Dialog), and I have the following code, copied from some example code on the web:
        Object font=null;
        try {
            font = Dispatch.call(selection, "Font","Arial").toDispatch();
        }catch(Exception ex){System.out.println("Error 47: "+ex);}
and the error I get is this:

Error 47: com.jacob.com.ComFailException: A COM exception has been encountered:
At Invoke of: Font
Description: Member not found.

As long as we're talking about JACOB, is there any way to create a hyperlink in the document? I can't find an example for it anywhere.. Thanx,

Doug