Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LOCAL oWord, oDocument, oRange, Lc_start, Lc_expr, Lc_ris, Ln_count, Lc_val
- DIMENSION Lc_funct[1]
- Lc_expr = ""
- Ln_count = 1
- oWord = CREATEOBJECT("Word.Application")
- oWord.Visible = .T.
- cFile = GETFILE()
- oDoc = oWord.Documents.Add(m.cFile)
- oRange = oWord.ActiveDocument.Range()
- nWordCount = oRange.Words.Count
- oRange.Collapse(1)
- FOR nWord = 1 TO m.nWordCount-1
- oRange.Expand(2)
- cWord = oRange.Text
- DO CASE
- CASE m.cWord = "<|<"
- Lc_start = .T.
- Lc_Expr = ""
- CASE m.cWord = ">|>"
- Lc_start = .F.
- Lc_funct[Ln_count] = Lc_Expr
- Ln_count = Ln_count + 1
- DIMENSION Lc_funct[Ln_count]
- CASE m.Lc_start
- Lc_expr = Lc_expr + m.cWord
- OTHERWISE
- *do anything
- ENDCASE
- oRange.Collapse(0)
- ENDFOR
- FOR i = 1 TO Ln_count-1
- oRange = oWord.ActiveDocument.Range()
- oRange.Find.Text = Lc_funct[i]
- oRange.Find.Replacement.Text = EVALUATE(Lc_funct[i])
- lFound = oRange.Find.Execute( , , , , , , , , , , 2 )
- ENDFOR
- FOR i = 1 TO Ln_count-1
- oRange = oWord.ActiveDocument.Range()
- oRange.Find.Text = "<|<"
- oRange.Find.Replacement.Text = ""
- lFound = oRange.Find.Execute( , , , , , , , , , , 2 )
- ENDFOR
- FOR i = 1 TO Ln_count-1
- oRange = oWord.ActiveDocument.Range()
- oRange.Find.Text = ">|>"
- oRange.Find.Replacement.Text = ""
- lFound = oRange.Find.Execute( , , , , , , , , , , 2 )
- ENDFOR
- MESSAGEBOX("DONE")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement