Stefan Gruber schrieb: > Meine Anforderung wäre allerdings, eine Kennung bzw. ein > Suchwort zu finden und dann den Textrange bis auf das > Zeilenende (nicht Absatzende!) zu erweitern, bevor er > formatiert wird. Oder wahlweise die ganze Zeile, weil das > Suchwort immer am Zeilenanfang ist. > > Ist es z.B. irgendwie möglich (auf Deinen Vorschlag bezogen), > das Zeilenende in den BIS-String zu codieren?
Ich habe dafür eine Möglichkeit gefunden. Es geht über reguläre Ausdrücke: Option Explicit public const VON as string = ">" public const BIS as string = "\n" Sub formatiereMyTextstellen GlobalScope.BasicLibraries.LoadLibrary("Tools") dim oDoc as object 'xDocument dim osdStart as object 'xSearchDescriptor dim otrStart as object 'xTextRange dim osdEnd as object 'xSearchDescriptor dim otrEnd as object 'xTextRange dim i as integer dim otxt as String oDoc = thisComponent osdStart = oDoc.createSearchDescriptor() osdStart.setSearchString(VON) otrStart = oDoc.findFirst(osdStart) if IsNull(otrStart) then exit sub 'stop wenn kein ergebnis osdEnd = oDoc.createSearchDescriptor() osdEnd.SearchRegularExpression = True osdEnd.setSearchString(BIS) otrEnd = oDoc.findFirst(osdEnd) if IsNull(otrEnd) then exit sub 'stop, wenn kein otrStart.gotoRange(oDoc.findnext(otrStart.End, osdEnd).End,true) i = otrStart.Start.CharHeight otrStart.CharHeight = i + 4 otrStart.CharWeight = com.sun.star.awt.FontWeight.BOLD otrStart.CharPosture= com.sun.star.awt.FontSlant.NONE otxt = otrStart.getString() otrStart.setString(DeleteStr(otxt,VON)) do until isNull(otrStart) otrStart=oDoc.findNext(otrStart.End,osdStart) if IsNull(otrStart) then exit sub 'stop wenn kein ergebnis otrStart.gotoRange(oDoc.findnext(otrStart.End, osdEnd).End,true) otrStart.CharHeight = i + 4 otrStart.CharWeight = com.sun.star.awt.FontWeight.BOLD otrStart.CharPosture= com.sun.star.awt.FontSlant.NONE otxt = otrStart.getString() 'otrStart.setString(DeleteStr(otxt,VON)) 'msgbox otrStart.getString() loop End Sub Stefan -- Liste abmelden mit E-Mail an: users+unsubscr...@de.libreoffice.org Probleme? http://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/ Tipps zu Listenmails: http://wiki.documentfoundation.org/Netiquette/de Listenarchiv: http://listarchives.libreoffice.org/de/users/ Alle E-Mails an diese Liste werden unlöschbar öffentlich archiviert