Ciao Piero,

Alle 11:27, domenica 11 dicembre 2005, Piero C. ha scritto:
> Carissimi Paolo e Marco
>
> vi ringrazio per la vostra attenzione e le vostre informazioni.
>
> Ho da poco installato la versione 2.0 di OOo  e in effetti dopo varie
> prove non si riesce ad effettuare la registrazione desiderata.
>
> Di conseguenza....   mi armero' di tanto coraggio e spulcero' il manuale
> per scrivere le macro in basic .... (ahime' non sono programmatore e di
> basic non ne capisco nulla)

Esiste un manuale della Sun che è disponibile anche in italiano:
http://docs.sun.com/app/docs/doc/817-3918?q=StarBasic

Sfortunatamente non troverai la soluzione al problema ma è sempre una lettura 
consigliabile.

Non mi pare ci sia nulla su sezioni e colonne nemmeno nel manuale di Andrew 
Pitonyak:
http://www.pitonyak.org/AndrewMacro.sxw

Ho trovato però un ottimo esempio sulla Developer's Guide nel capitolo 
dedicato ai documenti di testo:
http://api.openoffice.org/docs/DevelopersGuide/Text/Text.xhtml

ma è in Java...

Ok immagino che ora l'entusiasmo sia alle stelle :-)

Ti ho comunque preparato una traduzione in StarBasic dell'esempio. 
Lo trovi in fondo a questo post
Se hai dubbi chiedi pure.


ciao
Paolo M.



Attenzione: ripristinare le eventuali righe spezzate.
-----------------------------------------------------
REM  *****  BASIC  *****


sub TextColumnsExample
        
        ' initialize some variable for later use
        oDoc = ThisComponent
        oDocText = oDoc.Text
        oDocCursor = oDocText.createTextCursor()

        ' go to the end of the doucment
        oDocCursor.gotoEnd(False)
        
        ' insert a new paragraph
        oDocText.insertControlCharacter( _
oDocCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)

        ' insert the string 'I am a fish.' 100 times
        For I = 0  To 100
                oDocText.insertString(oDocCursor, "I am a fish.", False)
        Next I

        ' insert a paragraph break after the text
        oDocText.insertControlCharacter( _
oDocCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
        
        ' Jump back before all the text we just inserted
        oDocCursor.gotoPreviousParagraph(False)
        oDocCursor.gotoPreviousParagraph(False)

        ' Insert a string at the beginning of the block of text
        oDocText.insertString(oDocCursor, "Fish section begins:", False)

        ' Then select all of the text
        oDocCursor.gotoNextParagraph(True)
        oDocCursor.gotoNextParagraph(True)

        ' Create a new text section and get it's XNamed interface

        oTextSection = oDoc.createInstance("com.sun.star.text.TextSection")

        ' Set the name of our new section (appropiately) to 'Fish'
        oTextSection.setName("Fish")
        
        ' Create the TextColumns service and get it's XTextColumns interface
        oColumns = oDoc.createInstance("com.sun.star.text.TextColumns")

        ' We want three columns
        oColumns.setColumnCount(3)

        ' Get the TextColumns, and make the middle one narrow with a larger 
margin
        ' on the left than the right
        aSequence() = oColumns.getColumns()

        aSequence(1).Width = aSequence(1).Width / 2
        aSequence(1).LeftMargin = 350
        aSequence(1).RightMargin = 200
        
        ' Set the updated TextColumns back to the XTextColumns
        oColumns.setColumns(aSequence)

        ' Set the columns to the Text Section
        oTextSection.TextColumns = oColumns

        ' Insert the 'Fish' section over the currently selected text
        oDocText.insertTextContent(oDocCursor, oTextSection, True)

        ' Create a new empty paragraph and get it's XTextContent interface
        oNewPara = oDoc.createInstance("com.sun.star.text.Paragraph")

        ' Insert the empty paragraph after the fish Text Section
        oDocText.insertTextContentAfter(oNewPara, oTextSection)

end sub













 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Rispondere a