Bonsoir, Arnaud POUSSIER wrote: > Bonjour à tous, > > - Version OpenOffice 1.1.1 > J'ai fait la macro suivante avec l'enregistreur de macro sous calc afin > d'exporter un tableau (genre facturier). > La macro marche trés bien. Ma question est de savoir s'il est possible de > nommer le fichier PDF en fonction d'une cellule, c'est-à-dire si je met AAA > dans une cellule précise, le fichier s'exportera en AAA.pdf ?
Oui, cela est parfaitement et aisément faisable. Voir le code modifié après ta macro. Il serait préférable de poster les questions sur les macros sur la liste [email protected] > > 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 ---------------------------------------------------------------------- > dim args1(1) as new com.sun.star.beans.PropertyValue > args1(0).Name = "URL" > args1(0).Value = "file://posteréseau/partage/dossierpdf/000001.pdf" > args1(1).Name = "FilterName" > args1(1).Value = "calc_pdf_Export" > dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args1()) > end sub > > > Merci d'avance 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(0) 'Feuille1 oCell = oSheet.getCellRangeByName("A1") 'Cellule contenant le nom du fichier (uniquement le nom pour cet exemple) chemin = "file:///home/francois/Linux_Divers/" 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 -- Francois Gatto --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
