Disable F&R message if search failed
Posted: Thu Nov 10, 2022 10:07 am
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!!!

At first,I think Para"find in selected range:71680" will meet my demand,but the result just disappointed me!!

How to disable or auto click it and finish the find process?
Please help me , thx!!!
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);