Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

About create a Word file with Jacob

843829Jul 11 2001 — edited Dec 11 2001
Hello!

I want to create a new MSWord document with Jacob. All the examples that I have seen are for MSExcel and me do not serve. How I can create this document, insert text and images, the application to record and to close it from Java?

This it is the code that I use to open the application, but it trumps me when I try to create a new document.

public class DispatchTest {

public static void main(String[] args) {

ActiveXComponent dc = new ActiveXComponent ("Word.Application");
try {
dc.setProperty("Visible", new Variant(true));
Object documents = dc.getProperty("Documents").toDispatch();
Object document = Dispatch.get(documents, "Add").toDispatch();
} catch (Exception e) {
e.printStackTrace();
}
}


Thank you very much!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2002
Added on Jul 11 2001
4 comments
288 views