Welcome to the Indigo Rose Software discussion forums! You will need to sign up for a forum account and login before you can post. Need help? View the Forum FAQ.
Lua can't interface with COM objects directly. So you'll need LuaCOM to interact with Word's Object model. It's very similar to using LuaCOM for interacting with Excel. Have a look at some work I did on this late last year, over here. There's a demo apz attached there. Although the example is specifically for Excel, Word will be very similar.
There's also another thread specifically on Word & LuaCOM over here.
Some advice from the wise - this topic is not for the faint of heart. It's quite challenging and I found the whole affair an exercise in sheer frustration. The biggest problem you'll encounter is that documentation available to help navigate this particular minefield is very sparse.
Nb. And be prepared to deal with annoying COM errors frequently getting returned to AMS.
Microsoft Word *.docx are zipped XML and CSS files. You can decompress them, and edit the contents, if you are experienced in this, then compress the files back into a zip and rename back to the original extension.
I have developed an application named "The Australian Résumé Writer" in the past. This product was designed for building résumés, and offered the creation of documents in OpenOffice and Word formats, which could then be printed or delivered electronically for job applications. I believe that the owner of the application is no longer offering it online at this time, but you can see a demo here to get an idea.
During the development, I found out that changing OpenOffice files was somewhat easier to perform, so I used that instead of editing Word files directly. If the user wanted a Word file, it would be generated with the help of an OpenXML/ODF translator command line tool, and this optional step would take just a second or two.
I did not use COM, just the selected *.odt templates were decompressed, and the information provided by the candidate was formatted and injected into the "content.xml" of the chosen document, then saved, compressed and renamed back to *.odt. If desired, that file would be converted to *.docx and opened in Word for review. It was a long road to get this working smoothly, so if you really want to do this, be prepared to spend a long time with research.
Huh - I'm familiar with The Australian Résumé Writer. Have seen it before and played with it in the past. Interesting to know that you were responsible for its development. So would the process you outlined apply with other doc types from the MS suite?( ie. Excel, PowerPoint, etc).
thanks to all
i was able to solve the problem with your help
i extract my docx contents using zip.extract function
then, i replace the tags with my values in document.xml in word docx file
but I've seen a sample before i think is better than above solution :
Comment