Jump to content

Recommended Posts

Posted

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. :)

Posted

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)
Posted

  weaponx said:

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 :)

Posted

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?

Posted

  weaponx said:

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...