[LUGOS] OOo Basic

Bernard beernarrd at email.si
Sat Jan 27 17:42:10 CET 2007


Ne da bi se kaj ukvarjal, ampak nekoč sem hotel napisati dva makra, pa
me je minilo (žal); ravno tako sem se obregnil ob dispečer.
Drugače pa sem našel v BasicProgrammersGuide StarOffice7 našel tale citat:

"The content of the procedure described here for accessing the
paragraphs of a
text is comparable with the Paragraphs listing used in VBA, which is
provided in
the Range and Document objects available there. Whereas in VBA the
paragraphs
are accessed by their number (for example, by the Paragraph(1) call), in
StarOffice Basic, the Enumeration object described previously should be
used."

Še omenjena procedura:

Dim Doc As Object
Dim Enum As Object
Dim TextElement As Object
Doc = StarDesktop.CurrentComponent
Enum = Doc.Text.createEnumeration
While Enum.hasMoreElements
      TextElement = Enum.nextElement
      If TextElement.supportsService("com.sun.star.text.Paragraph") Then
            TextElement.String = Replace(TextElement.String, "you", "U")
            TextElement.String = Replace(TextElement.String, "too", "2")
            TextElement.String = Replace(TextElement.String, "for", "4")
      End If
Wend

Zadeva ima torej samo tekstne elemente, za katere je potem treba
preveriti, če so paragraf ali ne...
LP
Bernard

Miha Tomšič pravi:
> Hojla!
>
> A se je kdo kaj več ukvarjal z OOo Basicom (ali pa programiranjem in
> procesiranjem preko UNO povezave)?
>
> Zanima me predvsem ena svar: Ali je OOo Basic oz. UNO sploh sposoben
> videti dokument kot posamezne odstavke, sectione, headinge itd...? Iz
> vsega, kar sem prebral, se mi zdi, da zadeve delajo na povsem drugem
> nivoju. Neko dispečanje ukazov sem in tja... nastavljanje lastnosti...
> A uporabnega se pa ne da nič?
>
> Zelo bi me razveselil kakšen:
> foreach paragraph in ThisComponent.TextDocument.Paragraphs()
>    <neki>
> next
>
> Ali kaj podobnega... A si spet preveč domišljam?
>
> Lep dan in srečno, M.
> ------------------------------------------------------------------------
>
> _______________________________________________
> lugos-list mailing list
> lugos-list at lugos.si
> http://liste2.lugos.si/cgi-bin/mailman/listinfo/lugos-list
>   



More information about the lugos-list mailing list