Date: prev next · Thread: first prev next last
2020 Archives by date, by thread · List index


Bonjour,

Est-ce que ça transfert les styles d'un document Impress ?

Pierre

Le 07/06/2020 à 07:02, oj a écrit :
Le samedi 06 juin 2020 à 21:49 +0200, Stéphane Santon a écrit :
Bonjour,

Le 06/06/2020 à 18:52, Pierre Choffardet a écrit :
nouvStyle =
monDocument.CreateInstance("com.sun.star.style.Style")
J'ai un message d'erreur

Erreur d'exécution BASIC.

Une exception s'est produite :
Type: com.sun.star.lang.ServiceNotRegisteredException
Message: unknown service: com.sun.star.style.Style.
si quelqu'un peut me sortir de là
Et avec

com.sun.star.style.CharacterStyle
ou
com.sun.star.style.ParagraphStyle ?

Bonjour

Je ne sais si ça peut aider, mais :

Pour transférer des styles d'un document à l'autre par macro, j'utilise
ça :
        optionsdoc4 = doc4.StyleFamilies.getStyleLoaderOptions
        setPropVal(optionsdoc4, "LoadTextStyles", True)
        setPropVal(optionsdoc4, "LoadFrameStyles", True)
        setPropVal(optionsdoc4, "LoadPageStyles", True) ' ceci est
inutile (défaut)
        setPropVal(optionsdoc4, "LoadNumberingStyles", True)
        setPropVal(optionsdoc4, "OverwriteStyles", True)
        doc4.StyleFamilies.loadStylesFromURL(doc.URL, optionsdoc4())

avec cette déclaration :        

Dim optionsdoc as Variant, optionsdoc4 as Variant

doc est le document source.
doc4 est le document destination.

setPropVal est une sous-procédure qui affecte à chaque élément d'une
structure de données complexe une valeur:

Sub setPropVal(descr As Variant, nomProp As String, valProp As Variant)

        Dim p As Object

        for each p in descr
                if p.Name = nomProp then
                        p.Value = valProp
                        Exit Sub
                end if
        next
' la propriété nomProp n'existe pas !
        msgbox("Propriété "+nomProp+" inconnue.")
        'err = 423 ' déclencher erreur : Propriété ou méthode
introuvable
End Sub


Peut être se servir de tout ça ?

Cordialement,
O.J.



--
Envoyez un mail à users+unsubscribe@fr.libreoffice.org pour vous désinscrire
Les archives de la liste sont disponibles à https://listarchives.libreoffice.org/fr/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.