Bonjour, je suis nouveau ( la bonne excuse ;) ) et j'ai un soucis sur une variable, j'avais besoin de transformer du doc en pdf et j'ai donc exploiter la macro de BatchConv1.7.sxw qui est formidable d'ailleurs.
Mon soucis est que le fichier d'origine s'appelle toto.doc et lors de sa transformation on garde son petit nom d'origine en toto.doc.PDF, et je n'arrive pas a supprimer .doc de la variable filename. Quelqu'un aurait il la solution ? j'avoue ĂȘtre un peu perdu dans le monde de OOo et de ses macros. Merci par avance voici une copie du code utilisĂ© : '******************************************************************************** 'Copyright (C) 2006-2007 Laurent Godard '[EMAIL PROTECTED] 'This library is free software; you can redistribute it and/or 'modify it under the terms of the GNU Lesser General Public 'License as published by the Free Software Foundation; either 'version 2.1 of the License, or (at your option) any later version. 'This library is distributed in the hope that it will be useful, 'but WITHOUT ANY WARRANTY; without even the implied warranty of 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 'Lesser General Public License for more details. 'http://www.opensource.org/licenses/lgpl-license.php 'You should have received a copy of the GNU Lesser General Public 'License along with this library; if not, write to the Free Software 'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA '****************************************************************************** sub Export2PDF(filename as string) if not fileExists(filename) then exit sub endif dim argsLoad(0 ) as new com.sun.star.beans.PropertyValue argsLoad(0).Name = "Hidden" argsLoad(0).Value = True url = convertToURL(filename) theDoc = StarDesktop.loadComponentFromURL(url,"_blank",0,argsLoad()) filtername = "" if theDoc.supportsService("com.sun.star.text.TextDocument") then filtername = "writer_pdf_Export" endif if theDoc.supportsService("com.sun.star.sheet.SpreadsheetDocument") then filtername = "calc_pdf_Export" endif if theDoc.supportsService("com.sun.star.presentation.PresentationDocument") then filtername = "impress_pdf_Export" endif if filtername <> "" then dim argsSave(0) as new com.sun.star.beans.PropertyValue argsSave(0).Name = "FilterName" argsSave(0).Value = filtername urlDestination = convertToURL(filename & ".pdf") theDoc.storeToURL(urlDestination,argsSave()) theDoc.close(True) endif end sub --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
