Jump to content

How to search-replace in word document with StringRegExpReplace ?


Recommended Posts

Hello!

I know about _WordDocFindReplace () which does search-replaces in doc-file with instruments of MS Word.

But is it possible to do search-replaces with AutoIt regular expressions (StringRegExpReplace) in doc-file?

Thanks!

Link to comment
Share on other sites

for example, I know how to do replaces with regular expressions in HTML-pages:

#include<IE.au3>

$oIE = _IECreate($someInternetLink, 0, 0)
$oSpans = _IETagNameGetCollection ($oIE, "span")
;~ ConsoleWrite(@extended)


For $oSpan In $oSpans
    $sOutput  = StringRegExpReplace($oSpan.innerText, "\s+", " ")
    _IEPropertySet($oSpan,"innertext", $sOutput)
Next

$sHTML = _IEDocReadHTML($oIE)
$dFile = FileOpen($sPath,2)
If $dFile = -1 Then Exit
FileWrite($dFile, $sHTML)
FileClose($dFile)

but how to do the same thing in doc(x) files?

Edited by Suppir
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...