12 messages in org.openoffice.fr.prog[prog] AIDE PUBLIPOSTAGE
FromSent OnAttachments
Teddy GestelMay 22, 2006 1:42 am 
Bernard MarcellyMay 22, 2006 2:43 am 
André BaudoinMay 22, 2006 2:44 am 
André BaudoinMay 22, 2006 3:24 am 
MABILLE Bruno SZSIC57-IMLMay 22, 2006 7:19 am 
André BaudoinMay 23, 2006 11:54 pm 
Bernard MarcellyMay 24, 2006 1:18 am 
André BaudoinMay 24, 2006 2:15 am 
Bernard MarcellyMay 24, 2006 2:57 am 
André BaudoinMay 24, 2006 4:38 am 
Bernard MarcellyMay 24, 2006 8:10 am 
André BaudoinMay 28, 2006 11:55 pm 
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:[prog] AIDE PUBLIPOSTAGEActions...
From:Teddy Gestel (tedd@implicit.com)
Date:May 22, 2006 1:42:24 am
List:org.openoffice.fr.prog

Bonjour,

J’essai de faire une macro de publipostage :

Je me suis inspiré du livre Programmation Openoffice 2 pages 569 et 609 et de ooforum.org.

Sauf que je souhaite utiliser un fichier txt comme source de données.

Les données de ce fichier ont :

1ere ligne : La liste des colonnes séparée par des TABULATION.

2eme ligne : Les données

EXEMPLE du fichier:

CT_CopieTuteurReferent CT_DateDuJour

BLABLABLABLABLABLABLA 18-05-2006

Néanmoins quand je cree ma source de données elle est crée mais ne reconnaît pas le contenu du fichier.

J’ai l’impression qu’il ne sait pas pour les TABULATION.

Comment le lui faire comprendre ?

Pour le publipostage, J’ai une erreur pour : .CommandeType = com.sun.star.sdb.CommandType.TABLE

Merci pour votre aide.

Voici mon code :

Sub PublipostageFLATTEXTE()

Dim NomSource As String

Dim DocumentModele As String, RepertoireCible As String

Dim NomTable As String, NomChampTitreFichier As String

Dim monPublipostage As Object, MyProps()

Dim aDocURL As New com.sun.star.util.URL

Dim sDbName As String

Dim oDbContext As Object

Dim oDbInstance As Object

Dim oMailMerge As Variant

Dim monDocBase As Object

' xray aDocURL

oDbContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")

If oDbContext.hasByName("THE_DOCMOD_SOURCE") Then

MsgBox("THE_DOCMOD_SOURCE EXISTE DEJA")

oDbContext.revokeObject("THE_DOCMOD_SOURCE")

End If

Dim Chemin As String

Chemin = ConvertToURL("E:\data.dat")

oDbInstance = oDbContext.createInstance()

monDocBase = oDbInstance.DatabaseDocument

oDbInstance.DatabaseDocument.storeAsURL(ConvertToURL("E:\data.odb"), Array())

oDbInstance.URL = "sdbc:flat:" & Chemin

oDbContext.registerObject("THE_DOCMOD_SOURCE", oDbInstance)

monDocBase.store

NomSource = "THE_DOCMOD_SOURCE"

DocumentModele = "E:\DOCMOD.stw"

RepertoireCible = "E:\"

monPublipostage = createUnoService("com.sun.star.text.MailMerge")

With monPublipostage

.DataSourceName = NomSource

.CommandeType = com.sun.star.sdb.CommandType.TABLE

.Command = "THE_DOCMOD_SOURCE"

.OutputType = com.sun.star.text.MailMergeType.FILE

.FileNameFromColumn = False

.execute(MyProps())

End With

MsgBox "Fin du Publipostage"

End Sub

MERCI POUR VOTRE AIDE