Replaces text, no effect on style.
Code: Select all
For i= Lbound(matrix,1) To Ubound(matrix,1)
oReplace.SearchString = matrix(i)(0) ' Regular expression. Match any text
oReplace.ReplaceString = matrix(i)(1) 'Note the & places the found text back
' msgbox ( matrix(i)(0))
' oReplace.SearchRegularExpression=False Use regular expressions
oReplace.searchStyles=True 'We want to search styles
REM This is the attribute to find
SrchAttributes(0).Name = "CharWeight"
SrchAttributes(0).Name = "CharStyleName"
SrchAttributes(0).Value =com.sun.star.awt.FontWeight.NORMAL' tryed DONTKNOW, no difference
REM This is the attribute to replace it with
ReplAttributes(0).Name = "CharWeight"
ReplAttributes(0).Name = "CharStyleName"
ReplAttributes(0).Value =com.sun.star.awt.FontWeight.BOLD
REM Set the attributes in the replace descriptor
oReplace.SetSearchAttributes(SrchAttributes())
oReplace.SetReplaceAttributes(ReplAttributes())
oReplace.searchAll=True ' Do the entire document
oDoc.replaceAll(oReplace)
Next i