Hi all,

I need to copy a page_style from a document, and write it to another (new) document.

No problem for copy...

(NB The code must be in a shared library)

REM  *****  BASIC  *****
Global sStile_Pag ' the name style
Global oAktPage ' object style

SUB Copy_page_stile ' execute fron source doc.sheet
oSheet = ThisComponent.Sheets.getByName(_
ThisComponent.currentcontroller.activesheet.name)
sStile_Pag = oSheet.PageStyle 'copy the current style_name
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)
END SUB
'************************************

But write the page style on new document seems impossible...

'****************************************
SUB Write_page_style ' execute from target doc.sheet
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")
oTablePageStyles.insertByName(sStile_Pag, oAktPage)
' but the last line return error:
' IllegalArgumentException... :-(
' with message: . (dot).
END SUB
'*****************************************

what is wrong ?

Thanks for any help

Bart

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

Reply via email to