This may be a very simple answer but I've searched all over with no luck finding it. I am writing a macro to change old Word95 documents that contain ascii Greek font characters into Unicode (using the Greek and Coptic and Greek Extended areas of unicode). I did this already going character by character through the file but this did not access and change the characters in the footnotes.
So I'm now trying to do this task through Find/Replace in OOoBasic but I'm stumped about how to specify both the Find and the Replace font names. Below is sample code for where I am now with just two characters specified for the test (&HF061 = Greek alpha in the old ascii font which is &H03B1 in Unicode, etc.). The aFindReplace array holds the search for character followed by the replace character.
Thanks in advance for your help!
Steve
Code: Select all
Sub TEST01
Dim oDoc As Object
Dim aFindReplace, FandR
Dim i As Long
oDoc = ThisComponent
FandR = oDoc.createReplaceDescriptor
i = 0
Gosub FillArray
With FandR
.SearchCaseSensitive = True
.SearchRegularExpression = True
rem Do I set Find Font Name here somehow???
End With
While i <= uBound(aFindReplace)
FandR.setSearchString(aFindReplace(i)) ' i is set to find string
FandR.setReplaceString(aFindReplace(i+1)) ' Set i to replace string
i = i + 2
rem Do I set Replace Font Name here or earlier somehow???
oDoc.ReplaceAll(FandR)
Wend
MsgBox ("Conversion completed!",64,"All Done")
Exit Sub
FillArray:
aFindReplace = Array(Chr(&HF061), Chr(&H03B1), Chr(&HF0B7), Chr(&H1F71))
Return
End Sub