Re: Does Jawin allows Microsft word header, footer, table and Table of Contents?
"Mcnamara, Sean D" <[email protected]> Thu, 12 Jan 2006 08:44:12 -0500
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <57F935D6BB6B2543AF5D835DCE7CAF270F8E07@MD61EX100.ad.honeywell-tsi.com> |
Hi, It depends on whether you're trying to open up a new instance of Word, attach to it, and automate it (Jawin can do this); or whether you want to attach to an instance of Word that a user is working in and automate it (I am ignorant of whether or not Jawin can do this). As with any Jawin program, the first step in using Jawin is first to write a program in Visual Basic or another "native" Object Oriented language that is integrated with COM, that performs as much functionality as you can possibly wrap. Then, test this native code program and work out any bugs or errors that are caught. In the case of Word you may just want to write a VBA module inside of a document, and make a VBA macro that does the operations you want, given a series of variables as parameters to the function/macro. Test this to make sure it doesn't error out, because it's very hard to debug logic errors in your API calls from Jawin. Once you have a working series of API calls on the Word Automation library, you can begin translating this into Java/Jawin. All Word automation calls translate 1:1 into lines of Java code, although a few require a bit of modification (for instance, the constructor of a Word.Application instance needs the CLSID of the Word object). Use the Jawin code generator on the word TLB to pump out Java classes for all the Word objects. If you have to use methods that deal with Collections, you'll also need to open up VBVM60.DLL (in the windows\system32 folder) and export _Collection.java and Collection.java for the object "VBA.Collection". Then you can do something (in Java!) like: _Document doc = new _Document(Document.CLSID); VBA._Collection coll = doc.Shapes(1); _Shape someShape; ... coll.Add(someShape); I believe it has been demonstrated many times how you can use Jawin to interface with Word. It's a very common usage of Jawin to integrate Java with any Office application, as this conduit is well-supported and worked on a lot. I'm not sure but you may even be able to find a pre-built Java library that uses Jawin to interface with Office, but in a more "friendly" manner than the default code generation (which sometimes makes it inconvenient to pass objects back and forth into the COM world). Good luck, -Sean -----Original Message----- From: Discussion of Java/Win32/COM integration with Jawin [mailto:[email protected]] On Behalf Of Vinay Gupta Sent: Thursday, January 12, 2006 12:03 AM To: [email protected] Subject: [JAWIN] Does Jawin allows Microsft word header, footer, table and Table of Contents? Hi All, I am trying to write a java code to access Microsoft word. I need to write header , footer , Table of Contents and images in Word using java program. I am new to Jawin api so don't know how much I can do with jawin api for Microsft word.I tried with one of the sample code of jawin api .But it was very simple program ..doesn't have much functionality to know how to access different features of Microsft Word. It would be great help for me if anybody can tell us about the above problem ..and can send a sample code .Also if it is not possible in jawin ..Is there is any other free java api which can do all this functionality .. Any help is highly appreciated. Thanks in Advance Vinay Gupta NOTICE: This communication, including any attachment, contains information that may be confidential or privileged, and is intended solely for the entity or individual to whom it is addressed. If you are not the intended recipient, please notify the sender at once, and you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message is strictly prohibited. Nothing in this email, including any attachment, is intended to be a legally binding signature.