Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. LOCAL oWord, oDocument, oRange, Lc_start, Lc_expr, Lc_ris, Ln_count, Lc_val
  2. DIMENSION Lc_funct[1]
  3.  
  4. Lc_expr = ""
  5. Ln_count = 1
  6.  
  7. oWord = CREATEOBJECT("Word.Application")
  8. oWord.Visible = .T.
  9. cFile = GETFILE()
  10.  
  11. oDoc = oWord.Documents.Add(m.cFile)
  12.  
  13. oRange = oWord.ActiveDocument.Range()
  14. nWordCount = oRange.Words.Count
  15. oRange.Collapse(1)
  16. FOR nWord = 1 TO m.nWordCount-1
  17. oRange.Expand(2)
  18. cWord = oRange.Text
  19. DO CASE
  20.  
  21. CASE m.cWord = "<|<"
  22. Lc_start = .T.
  23. Lc_Expr = ""
  24.  
  25. CASE m.cWord = ">|>"
  26. Lc_start = .F.
  27. Lc_funct[Ln_count] = Lc_Expr
  28. Ln_count = Ln_count + 1
  29. DIMENSION Lc_funct[Ln_count]
  30.  
  31. CASE m.Lc_start
  32. Lc_expr = Lc_expr + m.cWord
  33.  
  34. OTHERWISE
  35. *do anything
  36.  
  37. ENDCASE
  38.  
  39. oRange.Collapse(0)
  40. ENDFOR
  41.  
  42.  
  43. FOR i = 1 TO Ln_count-1
  44. oRange = oWord.ActiveDocument.Range()
  45. oRange.Find.Text = Lc_funct[i]
  46. oRange.Find.Replacement.Text = EVALUATE(Lc_funct[i])
  47. lFound = oRange.Find.Execute( , , , , , , , , , , 2 )
  48. ENDFOR
  49.  
  50. FOR i = 1 TO Ln_count-1
  51. oRange = oWord.ActiveDocument.Range()
  52. oRange.Find.Text = "<|<"
  53. oRange.Find.Replacement.Text = ""
  54. lFound = oRange.Find.Execute( , , , , , , , , , , 2 )
  55. ENDFOR
  56.  
  57. FOR i = 1 TO Ln_count-1
  58. oRange = oWord.ActiveDocument.Range()
  59. oRange.Find.Text = ">|>"
  60. oRange.Find.Replacement.Text = ""
  61. lFound = oRange.Find.Execute( , , , , , , , , , , 2 )
  62. ENDFOR
  63. MESSAGEBOX("DONE")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement