Week 2 - update

Hannah Meeks hmeeks4135 at gmail.com
Sat Jun 25 20:06:03 UTC 2022


Hi,

This week I fixed my changes from the previous week, I also looked at the
XFind method on writer and wrote macro tests in word to test find and
replace.
Struggled for a while before finding this :

Selection seemed to be a problem to start with and the test will not work
without A.
Also seemed like the 'with' is broken and creates new find objects - B

    Selection.TypeText Text:="testing number two"
    ' without this it doesn't work ...
A .  ActiveDocument.Content.Select
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting

B.
+    let f = Selection.Find
+   With f ' works
-    With Selection.Find ' breaks things.
        .Text = "t"
        .Replacement.Text = "l"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
    End With

Looks like this could be due to code in sw/source/ui/vba/vbaselection.cxx
getFind
which I will aim to look at next week
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20220625/34c5569b/attachment.htm>


More information about the LibreOffice mailing list