Jump to content
Sign in to follow this  
hazed

Word automation with Format and underlining

Recommended Posts

hazed

Trying to get Word.udf to replace text in a word document with the same format/Font as what is replaced, with underlining.

I just don't get it. :)

Share this post


Link to post
Share on other sites
weaponx

This worked fine for me using Word 2003...

I just created a new document, typed "original", made it green, underlined it.

#include <Word.au3>
 $oWordApp = _WordCreate ("")
 $oDoc = _WordDocOpen ($oWordApp, @ScriptDir & "\New Microsoft Word document.doc")
 $oFind = _WordDocFindReplace($oDoc, "original", "REPLACED")
 _WordDocSave ($oDoc)
 _WordQuit ($oWordApp, 0)

Share this post


Link to post
Share on other sites
hazed

This worked fine for me using Word 2003...

I just created a new document, typed "original", made it green, underlined it.

#include <Word.au3>
 $oWordApp = _WordCreate ("")
 $oDoc = _WordDocOpen ($oWordApp, @ScriptDir & "\New Microsoft Word document.doc")
 $oFind = _WordDocFindReplace($oDoc, "original", "REPLACED")
 _WordDocSave ($oDoc)
 _WordQuit ($oWordApp, 0)
Maybe I didn't make myself clear enough. I have a script that replaces certian text in a word document with new text and then print it. Unfortunately the Font of the original text is not what the new text is, the new text is what the default text font is. There are multiple Size, Fonts in this document.

Also, I have not tried this on 2003, I am using the dreaded 2007 :)

Share this post


Link to post
Share on other sites
weaponx

I'm confused. Do you want to retain the style of the text being replaced, or do you want the style of the replacement text to be retained?

Share this post


Link to post
Share on other sites
hazed

I'm confused. Do you want to retain the style of the text being replaced, or do you want the style of the replacement text to be retained?

The original font of what is going to be replaced is: Arial 12 or Arial 10, and I want the replacement text to be the same. What I am getting is the replace text written in Times New Roman 12 which is the normal style.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.