This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Formatting Word ducuments using Jacob Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Formatting Word ducuments using Jacob" Watch "Formatting Word ducuments using Jacob" New topic
Author

Formatting Word ducuments using Jacob

Jonathan Moore
Ranch Hand

Joined: Nov 02, 2005
Posts: 36
Hi all,

I am working on a project to generate Word documents from Java code and am using the Jacob bridge. I'm able to do most things I require but am having real trouble with applying a formatting style to a a section of text.

I generally work out the calls to make by creating a macro and converting the code it produces into Jacob calls. Setting the style to "Heading 1" will produce the macro code:

Selection.Style = ActiveDocument.Styles("Heading 1")

I have converted this as follows:



but this produces the following exception:

com.jacob.com.ComFailException: Can't map name to dispid: Heading 1

Any ideas what's going wrong?

Thanks for any assistance.

Jon
 
 
subject: Formatting Word ducuments using Jacob
 
Similar Threads
Problems with Jacob Dispatch Class
MS Word *.doc to *.HTML
Calling Word macro from java getting read only popup
Executing a word macro on a document from java
COM Object call from Java