2 messages in org.openoffice.fr.progimage et formulaire base
FromSent OnAttachments
David DJun 17, 2007 4:37 am 
Anthony BenoistJun 17, 2007 6:39 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:image et formulaire baseActions...
From:David D (oce@free.fr)
Date:Jun 17, 2007 4:37:16 am
List:org.openoffice.fr.prog

Bonjour,

J'ai essayé d'utiliser la macro de F.A. VAN DEN BUSSCHE pour associer dynamiquement une image dans un formulaire Base. Cependant, au niveau de la déclaration oform, j'ai le message d'erreur suivant : "com.sun.star.container.NoSuchElementExeceptionMessage"

Le fichier Base se trouve dans un dossier dans lequel figure un autre dossier Photo Les photos ont été nommées comme prévu dans le mémo, c'est à dire Nom+Première lettre du prénom, en majuscule.

Pouvez-vous m'aider à comprendre le message d'erreur et à corriger la macro. Merci d'avance David

Function InitPathBadge() As String rem ATTENTION ceci est un QDC (quick and durty code) Dim Chemin As String Dim i As Integer Dim j As Integer Dim Timbre_path As String

Chemin=ThisComponent.getParent.DataSource.Name i=len(Chemin) j=0 Do j=j+1 r=InStr(j,Chemin,getPathSeparator) if r=0 Then Exit Do End If Loop While j<i rem getPathSeparator permet de s'affranchir du type de séparateur InitPathBadge=Left(Chemin,j-1)+"Photo"+getPathSeparator End Function

sub AfficherImage() Dim oForm As Object Dim oImageControl As Object Dim LeFichier as string 'Dim Chemin as string Dim oNom As Object Dim oPrenom As Object ' Chemin=InitPathBadge() oForm = ThisComponent.DrawPage.Forms.getByName("Formulaire") oNom = oForm.getByName("Nom") oPrenom = oForm.getByName("Prenom") LeFichier = oNom.getCurrentValue() & Left(oPrenom.getCurrentValue(),1) oImageControl = oForm.GetByName("ImageControl") oImageControl.ImageURL=Chemin & LeFichier & ".JPG" end sub