Ecco il codice funzionante...

Sono un po' perplesso sulle quelle viariabili globali... le ho tolte...
e tutto pare funzionare ugualmente.
(Le due macro stanno nello stesso modulo in una libreria condivisa.)


'**************************************************

SUB Copy_PageStyle ' da eseguire sulla sheet sorgente
oSheet = ThisComponent.Sheets.getByName(_
ThisComponent.currentcontroller.activesheet.name)
sStile_Pag = oSheet.PageStyle 'nome dello stile corrente
                        ' sulla sheet sorgente
oDesktop = createUnoService( "com.sun.star.frame.Desktop" )
oController = oDesktop.CurrentFrame.Controller
oDocument = oController.Model
oStyleFam = oDocument.StyleFamilies
oTablePageStyles = oStyleFam.getbyName("PageStyles")
oAktPage = oTablePageStyles.getByname(sStile_Pag)
aProperties = oAktPage.PropertySetInfo.Properties
END SUB


SUB Write_PageStyle ' da eseguire sulla
                    ' sheet di destinazione
oSheet = ThisComponent.Sheets.getByName(_
ThisComponent.currentcontroller.activesheet.name)
oDesktop = createUnoService( "com.sun.star.frame.Desktop" )
oController = oDesktop.CurrentFrame.Controller
oDocument = oController.Model
oStyleFam = oDocument.StyleFamilies
oTablePageStyles = oStyleFam.getbyName("PageStyles")
oCpyStyle = oDocument.createInstance("com.sun.star.style.PageStyle")
oTablePageStyles.insertByName(sStile_Pag, oCpyStyle)
aProperties =  oAktPage.PropertySetInfo.Properties
For i = LBound(aProperties) to UBound(aProperties)
    sX = aProperties(i).Name
    If  oAktPage.getPropertyState(sX) =
com.sun.star.beans.PropertyState.DIRECT_VALUE Then
        vTmp =  oAktPage.getPropertyValue(sX)
        oCpyStyle.setPropertyValue(sX, vTmp)
    EndIf
Next i
END SUB

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

Rispondere a