31 messages in org.openoffice.fr.progRe: [prog] Probleme concernant le dat...
FromSent OnAttachments
thom...@free.frApr 15, 2005 5:51 am 
Laurent GodardApr 15, 2005 6:04 am 
thom...@free.frApr 15, 2005 6:22 am 
thom...@free.frApr 15, 2005 7:23 am 
Bernard MarcellyApr 15, 2005 7:43 am 
thom...@free.frApr 15, 2005 7:59 am 
thom...@free.frApr 18, 2005 12:05 am 
Bernard MarcellyApr 18, 2005 1:53 am 
thom...@free.frApr 18, 2005 3:03 am 
thom...@free.frApr 18, 2005 5:50 am 
thom...@free.frApr 18, 2005 7:35 am 
Bernard MarcellyApr 18, 2005 9:40 am 
Thomas CoqueryApr 20, 2005 5:48 am 
Thomas CoqueryApr 20, 2005 6:35 am 
Thomas CoqueryApr 20, 2005 7:55 am 
Laurent GodardApr 20, 2005 8:10 am 
Thomas CoqueryApr 20, 2005 11:11 pm 
Josianne SAUVAGEApr 21, 2005 1:51 am 
will...@free.frApr 21, 2005 2:07 am 
Thomas CoqueryApr 21, 2005 2:08 am 
will...@free.frApr 21, 2005 2:22 am 
Alain NowakApr 21, 2005 7:30 am 
Josianne SAUVAGEApr 21, 2005 9:01 am 
Jean-MichelApr 21, 2005 9:06 am 
GVApr 21, 2005 10:20 am 
Josianne SAUVAGEApr 22, 2005 2:15 am 
Thomas CoqueryApr 22, 2005 2:27 am 
Thomas CoqueryApr 27, 2005 6:50 am 
Thomas CoqueryApr 29, 2005 2:47 am 
Laurent GodardApr 29, 2005 3:06 am 
Thomas CoqueryApr 29, 2005 6:15 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: [prog] Probleme concernant le datasource dans un publipostage (ma table n'existe pas)Actions...
From:thom...@free.fr (thom@free.fr)
Date:Apr 18, 2005 7:35:18 am
List:org.openoffice.fr.prog

Je cherche à comprendre... Ma méthode même corrigée ne fonctionne pas alors que si je me sers du morceau de code que Bernard m'a gentiment donné cela marche... code de bernard:(légèrement retouché pour les noms et chemins)

ConnectOpenOffice; // établir la connexion, si pas déjà fait DataContext:= CreateUnoService('com.sun.star.sdb.DatabaseContext'); NomSource:= 'src1'; if DataContext.hasbyname(NomSource) then Memo_Enumeration.Lines.Add(NomSource +' existe') else begin // mettre les fichiers dans ce répertoire Chemin:= convertToURL('c:\Dossiers\Coquery'); lesProps:= CreateProperties([ 'Extension', 'txt', 'CharSet', 'ISO-8859-15', 'FixedLength', True, 'HeaderLine', True, 'FieldDelimiter', ';', 'StringDelimiter', '"', 'DecimalDelimiter', '.', 'ThousandDelimiter', ',']); uneInstance:= DataContext.createInstance; DataContext.registerObject(NomSource, uneInstance); uneInstance.URL:= 'sdbc:flat:' + Chemin; uneInstance.Info:= lesProps; Memo_Enumeration.Lines.Add('src ajoutée'); end;

mon code: //création du service databasecontext Datacontext:=OpenOffice.createInstance('com.sun.star.sdb.DatabaseContext'); //si openoffice connait la source src1 if Datacontext.hasbyname('src1') then Memo_Enumeration.Lines.Add('src1 existe déjà') else begin // Core reflection est utilisé pour pouvoir créer des property value CoreReflection := OpenOffice.createInstance ('com.sun.star.reflection.CoreReflection'); //création d' un tableau de propertyvalues équivalent à createproperties arguments:= VarArrayCreate([0,7], varVariant);

CoreReflection.forName('com.sun.star.beans.PropertyValue').createObject(PropertyValue); PropertyValue.Name := 'Extension'; PropertyValue.Value := 'txt'; arguments[0]:= PropertyValue ; PropertyValue.Name := 'CharSet'; PropertyValue.Value := 'ISO-8859-15'; //ou 'ISO646-FR1' arguments[1]:= PropertyValue ; PropertyValue.Name := 'FixedLength'; PropertyValue.Value := true; arguments[2]:= PropertyValue ; PropertyValue.Name := 'HeaderLine'; PropertyValue.Value := true; arguments[3]:= PropertyValue ; PropertyValue.Name := 'FieldDelimiter'; PropertyValue.Value := ';'; arguments[4]:= PropertyValue ; PropertyValue.Name := 'StringDelimiter'; PropertyValue.Value := '"'; arguments[5]:= PropertyValue ; PropertyValue.Name := 'DecimalDelimiter'; PropertyValue.Value := '.'; arguments[6]:= PropertyValue ; PropertyValue.Name := 'ThousandDelimiter'; PropertyValue.Value := ','; arguments[7]:= PropertyValue ; //création de la datasource avec parametres instance:=Datacontext.createInstance; //enregistrement dans openoffice datacontext.registerObject('src1',instance); instance.URL:= 'sdbc:flat:file:///C:/Dossiers/coquery'; instance.Info:= arguments; end;

Quelle différence y a-t-il entre le CreateProperties et ma création d'un tableau de propertyvalues??? ou alors cela vient-il du fait que bernard utilise un ConnectOpenOffice qui instancie des services que je n'utilise pas mais qui seraient nécessaires??? (Introspection et DispatchHelper) J'aimerais bien comprendre les différences car si je trouve pratique d'utiliser des outils faits par d'autres j'aime bien savoir ce qu'ils font de plus... Je les ai épluchés déjà mais à part le ConnectOpenOffice qui contient des instanciations supplémentaires , je ne voie pas trop de différences...