Sign in to follow this  
Followers 0
Suppir

How to search-replace in word document with StringRegExpReplace ?

2 posts in this topic

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!

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

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

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  
Followers 0