Hi Piet,

because your makro left over empty paragraph marks I added a few lines.

Walther

----------  Weitergeleitete Nachricht  ----------

Subject: Re: free text editor (was: [libreoffice-users] delete hidden formated 
text in odt
Date: Donnerstag, 5. Mai 2016
From: Walther Koehler <walther.koeh...@posteo.de>
To: Piet van Oostrum <pie...@pietvanoostrum.com>

Hi Piet,

superb, a makro! I will try it later on.

Walther

Am Mittwoch, 4. Mai 2016 schrieb Piet van Oostrum:
> Walther Koehler wrote:
>  > Am Mittwoch, 4. Mai 2016 schrieb Piet van Oostrum:
>  > > Walther Koehler wrote:
>  > >  > Thank you.
>  > >  > Your procedure is principally what I need.
>  > >  > However, quite complicated for routine work.
>  > >  >
>  > >  > Walther
>  > >
>  > > The first part (replacing hidden text with colored text) could be done
>  > > with a script.
>  >
>  > yes, and the whole procedure could be packed in a basic makro.
>  > The script can be called by a shell command within a makro, the replace
>  > functions realized with dispatcher commands.
>  >
>  > Let us try it.
>  >
>  > Walther
>
> Even simpler:
>
> Here is a Basic macro that just walks through the document, and deletes all
> hidden text. No unzipping, editing, etc. It just works inside the ODT
> document in LO.
>
> It only considers normal plain text, i.e. not inside tables, sections,
> frames, footnotes, etc. If you want that, these have to be specially coded.
>
> REM  *****  BASIC  *****
>
> Sub Main
>
> Dim oEnum                   'com.sun.star.container.XEnumerationAccess
> Dim oPar
> Dim oSecEnum                'com.sun.star.container.XEnumerationAccess
> Dim oParSection
>
> oEnum = ThisComponent.Text.createEnumeration()
> oTxt=ThisComponent.Text
> Do While oEnum.hasMoreElements() 
>               oPar = oEnum.nextElement()
>               If oPar.supportsService("com.sun.star.text.Paragraph") Then
>                               oSecEnum = oPar.createEnumeration()
>                               flag=0
>                               Do While oSecEnum.hasMoreElements() 
>                                               oParSection = 
> oSecEnum.nextElement()
>                                               If oParSection.TextPortionType 
> = "Text" AND oParSection.CharHidden  
Then
>                                               oParSection.setString("")
>                                               else
>                                                flag=1
>                                               End If 
>                               Loop
>                               if flag=0 then oTxt.removeTextContent(oPar)
>               End If
> Loop
>
> End Sub
> --
> Piet van Oostrum <p...@vanoostrum.org>
> WWW: http://pietvanoostrum.com/
> PGP key: [8DAE142BE17999C4]



-------------------------------------------------------

-- 
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to