Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use QM's regular expression to replace text in word
#16
I tried the following method, find and replace the format, the result is a failure :oops:

Macro Macro2
Code:
Copy      Help
;/exe 1
out

typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._getactive ;;connect to Word. Note: need the /exe 1.
Word.Document doc=app.ActiveDocument
str s=doc.Content.Text
;out s
s.findreplace("[13]" "[10]") ;;Word text newlines are [13]
str rx=
;;(?xm)
;;help
ARRAY(POINT) a; int i
if(!findrx(s rx 0 4 a)) end "failed, regular expression"
for i 0 a.len
,VARIANT v1(a[0 i].x) v2(a[0 i].y)
,Word.Range ran=doc.Range(v1 v2)
,ran.Find.Font.Bold=1
,ran.Find.Replacement.Font.Bold=0


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)