Consider this small program, looks innocent... Find something that matches an attribute (no replacing).

Sub SearchTest(oProps())
  Dim oFind
  Dim oFound
  Dim oDoc

  oDoc = ThisComponent

  oFind = oDoc.createSearchDescriptor()
  With oFind
   .SearchString  = ".*"
   .SearchRegularExpression = True
   .SearchAll = True
  End With

  oFound = oDoc.FindAll(oFind)
  print "" & oFound.count & " for " & oProps(0).Name
End Sub

Now, call it as follows:

Sub FindCharStyle
  Dim SearchProps(0) as new

  'Matches everything, and erases everything that it finds.
  searchProps(0).name = "CharStyleName"
  searchProps(0).value = "_OOoComputerLiteral"
  searchProps(0).value = "xyzzy"

  'This finds things as expected
  searchProps(0).name = "CharWeight"
  searchProps(0).value = 100

  searchProps(0).Name = "CharFontName"
  searchProps(0).Value = "Times New Roman"
  searchProps(0).Value = "Albany"

  'Finds stuff, but erases everything that it finds.
  searchProps(0).Name = "CharFontNameAsian"
  searchProps(0).Value = "HG Mincho Light J"

  searchProps(0).Name = "CharFontPitch"
  searchProps(0).Value = 2

  searchProps(0).Name = "CharNoHyphenation"
  searchProps(0).Value = True
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.

Andrew Pitonyak
My Macro Document:
My Book:
See Also:

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to