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


Hallo Karl,

das ist fast das richtige; es muesste am Ende der gesammelte Text in eine neue Dokument im A4 Format gespeichert werden und nicht in das geoeffnete.

es ist moeglich, dass der Poster des Makros mir damals das fertige Makro direkt zugemailt hat und es deshalb nicht im Archiv ist

Gruss
Martin


Am 03.04.2020 um 13:22 schrieb Karl Zeiler:
Hallo Martin,

nach einer Volltextsuche in meinem Mailarchiv wurde ich fündig. Autor des Makros ist Hans-Werner Herold. Es folgten allerdings noch weitere Änderungen im Code. Nachfolgend seine letzte Anpassung.

Da ich kein Spezialist für Makros bin, kann ich dir leider nicht selbst helfen. Vielleicht klappt es ja mit dieser Version.

Gruß
Karl

Hans-Werner Herold schrieb am 23.10.2018:
Hallo Martin,
[...]
Ich habe das Makro entsprechend angepasst ohne dabei Deine Makro-Grundidee zu verändern:

+ Ich habe ein ARRAY "arrayText" unbekannter Größe angelegt.
+ Die FRAME-Inhalte werden jetzt fortlaufend in die einzelnen ARRAY-Elemente von "arrayText" abgespeichert. + Abschließend werden die ARRAY-Element-Inhalte von "arrayText" in einer rückwärts laufenden Schleife nach "sText" abgespeichert.
+ "sText" wird wie gewohnt ausgegeben.

Zum Test habe ich 3 Text-Rahmen angelegt:

"-1- Heute ist ein schöner Tag !"
"-2- Heute ist ein schöner Tag !"
"-3- Heute ist ein schöner Tag !"

Alle 3 Texte werden komplett in richtiger Reihenfolge ausgegeben.

Hier das modifizierte Makro:


Sub DeleteFrameSaveText
' GELÖSCHT: Dim oViewCursor as object
' GELÖSCHT: Dim oText As Object
Dim arrayText() ' NEU: ARRAY unbekannter Größe anlegen
oDoc =ThisComponent
oTF = oDoc.getTextFrames
c = oTF.Count - 1
' GELÖSCHT: sText = " "
' GELÖSCHT: For i = 0 to c
iText = -1 ' NEU: INDEX-Variable für ARRAY vorbelegen
For i = c to 0 Step -1
thisF = oTF.getByIndex(i)
iText = iText + 1 ' NEU: INDEX-Variable für ARRAY hochzählen
ReDim Preserve arrayText(iText) ' NEU: Neues ARRAY-Element indizieren !
arrayText(iText) = thisF.String & chr(10) & chr(10) ' NEU: FRAME-Inhalt an neues ARRAY-Element zuweisen
' GELÖSCHT: sText = sText & thisF.String & chr(10) & chr(10)
thisF.dispose()
Next
sText = "" ' NEU: STRING-Variable vorbelegen
For iText = Ubound(arrayText) To 0 Step -1 ' NEU: Schleife rückwärts über ARRAY-Elemente sText = sText & arrayText(iText) ' NEU: Inhalt aktuelles ARRAY-Element an STRING-Variable
Next iText
' GELÖSCHT: oDoc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, Array())
oViewCursor= thisComponent.GetCurrentController.ViewCursor
If IsEmpty(oViewCursor.Cell) Then
oText=thiscomponent.text
Else
oText=oViewCursor.Cell.Text
End If
oText.insertString(oViewCursor,sText,false)
End Sub


Gruß
Hans-Werner ;-))




--
Liste abmelden mit E-Mail an: users+unsubscribe@de.libreoffice.org
Probleme? https://de.libreoffice.org/hilfe-kontakt/mailing-listen/abmeldung-liste/
Tipps zu Listenmails: https://wiki.documentfoundation.org/Netiquette/de
Listenarchiv: https://listarchives.libreoffice.org/de/users/
Datenschutzerklärung: https://www.documentfoundation.org/privacy

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.