To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=114662 Issue #|114662 Summary|Search with attributes erases all text Component|api Version|OOo 3.2.1 Platform|Unknown URL| OS/Version|All Status|NEW Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|code Assigned to|jsc Reported by|pitonyak
------- Additional comments from [email protected] Tue Sep 21 20:05:16 +0000 2010 ------- This bug was reported to me on the OOo mailing list. http://www.oooforum.org/forum/viewtopic.phtml?t=106461 I created a small test case and verified this on my computer. Consider this small program, looks innocent... Find something that matches an attribute (no replacing). Unfortunately, if you search for the wrong attribute, it will find everything in the document and delete it. Sub SearchTest(oProps()) Dim oFind Dim oFound Dim oDoc oDoc = ThisComponent oFind = oDoc.createSearchDescriptor() With oFind .SearchString = ".*" .SearchRegularExpression = True .SearchAll = True End With oFind.setSearchAttributes(oProps) oFound = oDoc.FindAll(oFind) print "" & oFound.count & " for " & oProps(0).Name End Sub Here is how you can call the test macro.... Note that this is very simple. Sub FindCharStyle Dim SearchProps(0) as new com.sun.star.beans.PropertyValue 'Matches everything, and erases everything that it finds. searchProps(0).name = "CharStyleName" searchProps(0).value = "_OOoComputerLiteral" searchProps(0).value = "xyzzy" '??SearchTest(searchProps) 'This finds things as expected searchProps(0).name = "CharWeight" searchProps(0).value = 100 SearchTest(searchProps) 'Fails searchProps(0).Name = "CharFontName" searchProps(0).Value = "Times New Roman" searchProps(0).Value = "Albany" SearchTest(searchProps) 'Finds stuff, but erases everything that it finds. searchProps(0).Name = "CharFontNameAsian" searchProps(0).Value = "HG Mincho Light J" '??SearchTest(searchProps) 'Works searchProps(0).Name = "CharFontPitch" searchProps(0).Value = 2 SearchTest(searchProps) 'Works searchProps(0).Name = "CharNoHyphenation" searchProps(0).Value = True SearchTest(searchProps) End Sub Searching on CharStyle name always matches, and then it erases all the text that it finds (well, it replaces it with an empty string). The same for CharFontNameAsian. Searching on CharFontName simply never matches, which is also a bug. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
