7 messages in org.openoffice.fr.progVérifier l'existence d'un fichier
FromSent OnAttachments
Arnaud POUSSIERJun 28, 2006 3:19 am 
Laurent GodardJun 28, 2006 3:24 am 
Arnaud POUSSIERJun 28, 2006 3:26 am 
Arnaud POUSSIERJun 29, 2006 12:26 am 
Laurent GodardJun 29, 2006 12:50 am 
Olivier VillatteJun 29, 2006 1:15 am 
Laurent GodardJun 29, 2006 1:31 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:Vérifier l'existence d'un fichierActions...
From:Arnaud POUSSIER (arna@douane.finances.gouv.fr)
Date:Jun 28, 2006 3:19:47 am
List:org.openoffice.fr.prog

Bonjour, Dans la macro suivante généré grâce à Francois Gatto, merci à lui, le nom du
fichier exporté en pdf est lié à un cellule précise. Est-ce qu'il est possible de vérifier s'il le fichier n'existe pas déjà dans le
repertroire de detination ?

Merci d'avance et bonne journée

sub exportpdf rem ------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem -------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem -------------------------------------------------------------------- rem définition de l'URL de destination oDoc = ThisComponent oSheet = oDoc.getSheets().GetByIndex(1) 'Feuille1 oCell = oSheet.getCellRangeByName("S5") 'Cellule contenant le nom du fichier
(uniquement le nom pour cet exemple) chemin = "file://reseau/partage/DOSSIER" nomfichier = oCell.String & ".pdf" 'Récupération du nom auquel on ajoute
l'extension destinationURL = chemin & nomfichier MsgBox destinationURL 'Des tests de confirmation seraient souhaitables

dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = "URL" args1(0).Value = destinationURL args1(1).Name = "FilterName" args1(1).Value = "calc_pdf_Export" dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1()) end sub