Seite 1 von 1

Ersetzen durch unformatierten Text

Verfasst: Mo 20. Feb 2017, 10:08
von Butch
Kann mir hier jemand bei einem Makro helfen? Ich suche und suche und finde keine Lösung ...

Ich möchte bei Ersetzungen festlegen, dass diese OHNE JEDE FORMATIERUNG erfolgen sollen. Unten ein Ausschnitt aus meinem Makro, wo das angepasst werden müsste. Die rot markierten Zeilen wären also auf "KEINE FORMATIERUNG" (also: das, was anstelle des Gesuchten kommt, soll im Standardformat sein) zu ändern.

ReplAttributes(0).Name = "CharHeight"
ReplAttributes(0).Value = 10

Code: Alles auswählen

  Dim outDoc As Object
  Dim oReplace As Object
  Dim SrchAttributes(0) As New com.sun.star.beans.PropertyValue
  Dim ReplAttributes(0) As New com.sun.star.beans.PropertyValue
' ...
  oReplace = outDoc.createReplaceDescriptor
  oReplace.searchAll=True
  oReplace.searchStyles=True
  oReplace.SearchRegularExpression=True
  
  oReplace.SearchString  = ".*"
  oReplace.ReplaceString = "<i>$0</i>"
  SrchAttributes(0).Name  = "CharPosture"
  SrchAttributes(0).Value = com.sun.star.awt.FontSlant.ITALIC
  oReplace.SetSearchAttributes(SrchAttributes())
  ReplAttributes(0).Name  = "CharHeight"
  ReplAttributes(0).Value = 10
  oReplace.SetReplaceAttributes(ReplAttributes())
  outDoc.replaceAll(oReplace)