Disable F&R message if search failed

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
wanglong
Posts: 51
Joined: Fri Sep 09, 2022 10:57 am
Location: Beijing,China

Disable F&R message if search failed

Post by wanglong »

When I use ".uno:ExecuteSearch" to find some String that not be found,I don't want the dialog"The OpenOffice Writer has found the end location of the document. Whether you want to continue the search from the beginning of the document".

How to disable or auto click it and finish the find process?

Please help me , thx!!! :super: :super: :super: :super:

Code: Select all

PropertyValue[] property1 = new PropertyValue[]{new PropertyValue(),new PropertyValue(),new PropertyValue()};
        property1[0].Name = "SearchItem.SearchString";
        property1[0].Value = find;
        property1[1].Name = "Quiet";
        property1[1].Value = false;
        property1[2].Name = "SearchItem.SearchFlags";
        property1[2].Value = 71680;       //find in selected range 
        PropertyValue[] property2 = new PropertyValue[]{new PropertyValue()};
        property2[0].Name = "Select";
        property2[0].Value = true;
        PropertyValue[] property3 = new PropertyValue[]{new PropertyValue()};
        property3[0].Name = "Text";
        property3[0].Value = replace;
        do{
            xTextViewCursor.gotoRange(xTextRangeA, false);  //to start
            long index = N;
            while(index-- > 0){
                xDispatchHelper.executeDispatch(xDispatchProvider, ".uno:GoDown", "", 0, property2);  //go down N line
            }
            DispatchResultEvent oo = (DispatchResultEvent)xDispatchHelper.executeDispatch(xDispatchProvider, ".uno:ExecuteSearch", "", 0, property1); //find matched string
            if((boolean)oo.Result == false)
                break;
            xDispatchHelper.executeDispatch(xDispatchProvider, ".uno:InsertText", "", 0, property3);
        }while(true);
At first,I think Para"find in selected range:71680" will meet my demand,but the result just disappointed me!! :crazy: :crazy:
Libre Office 7.6 on Windows 11.
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: How to disable F&R Reach the Bottom message dialog?

Post by Villeroy »

http://fivedots.coe.psu.ac.th/~ad/jlop/#writer (Chapter 9. Text Search and Replace [XSearchable])
 Edit: 2024-02-28: Broken link -- MrProgrammer, forum moderator  
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: How to disable F&R Reach the Bottom message dialog?

Post by RoryOF »

I think it might make sense to disable that warning for macro F&R operations if (and only if?) the search process has commenced from the very start of the file, so that the entire file had been searched; then the message is redundant.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Post Reply