Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index


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+unsubscribe@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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.