Jump to content

Word automation with Format and underlining


hazed
 Share

Recommended Posts

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)
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

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