8 messages in org.openoffice.fr.progRe: Re: [prog] Stockage d'info de con...
FromSent OnAttachments
vinc...@regis-dgac.netMay 17, 2004 12:01 am 
Alexandre MILLOTMay 17, 2004 12:07 am.gif
vinc...@regis-dgac.netMay 17, 2004 12:28 am 
Alexandre MILLOTMay 17, 2004 12:43 am.gif
Bernard MarcellyMay 17, 2004 3:22 am 
Didier DPMay 17, 2004 3:45 am 
BobMay 17, 2004 4:48 am 
vinc...@regis-dgac.netMay 17, 2004 6:16 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Re: [prog] Stockage d'info de conf d'une une macro ds un doc (ou ailleurs)Actions...
From:vinc...@regis-dgac.net (vinc@regis-dgac.net)
Date:May 17, 2004 6:16:59 am
List:org.openoffice.fr.prog

Bonjour,

Bernard Marcelly a écrit :

Il y a t-il moyen de stocker cela dans le doc dsw généré ?

Tu pourrais stocker tes informations dans le texte d'un dessin élémentaire quelconque. Et rendre ce dessin invisible.

Pas mal comme truc. Les options à stocker sont déclarées dans un module, toutes seules. Pour sauver les nouvelles options, on réecrit ce module à partir du code basic avec les nouvelles valeurs. C'est rapide et efficace !

Sinon, j'ai trouve une autre astuce qui permet d'ajouter des attributs externes dans un fichier Draw. Voici les fonctions:

Function LireAttribut(namespace,nom,Optional defaut As String) attrs = oPage.UserDefinedAttributes nomcomplet = namespace+":"+nom If attrs.hasByName(nomcomplet) Then attr = attrs.getByName(nomcomplet) LireAttribut = attr.Value ElseIf Not IsMissing(defaut) Then LireAttribut = defaut End If End Function

Function SauverAttribut(namespace,nom,valeur As String) Dim attr As New com.sun.star.xml.AttributeData attr.NameSpace = namespace attr.Type = "CDATA" attr.Value = valeur attrs = oPage.UserDefinedAttributes nomcomplet = namespace+":"+nom If attrs.hasByName(nomcomplet) Then attrs.replaceByName(nomcomplet,attr) Else attrs.insertByName(nomcomplet,attr) End If oPage.UserDefinedAttributes = attrs SauverAttribut = valeur End Function

Par exemple, pour mon cas, j'utilise cela comme cela:

oDlg.Model.monTexte.Text = LireAttribut("Genealogie", "monTexte","blabla") oDlg.Execute LireAttribut("Genealogie", "monTexte",oDlg.Model.monTexte.Text)

Les attributs sont attaches a une page mais on doit pouvoir les attacher a un document draw (tout ce qui est GenericDrawPage, Shape, ...

Si ca peut servir.

a+ Vincent