About create a Word file with Jacob
843829Jul 11 2001 — edited Dec 11 2001Hello!
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!