7 messages in org.openoffice.fr.progRe: [prog] Erreur en exportant en PDF...
FromSent OnAttachments
Frédéric VuillodMay 17, 2006 3:14 am 
Laurent GodardMay 17, 2006 3:31 am 
Bernard MarcellyMay 17, 2006 3:42 am 
Frédéric VuillodMay 17, 2006 3:43 am 
Frédéric VuillodMay 17, 2006 3:46 am 
serg...@free.frMay 17, 2006 6:05 am 
Frédéric VuillodMay 17, 2006 6:24 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:Re: [prog] Erreur en exportant en PDF depuis Delphi...Actions...
From:Frédéric Vuillod (f.vu@free.fr)
Date:May 17, 2006 3:43:21 am
List:org.openoffice.fr.prog

Laurent Godard a écrit :

qelle version de ooo ? 2.02 sou Win XP SP2 quel filtername utilises tu ? un bout de code ?

Allez la procédure au complet (filternames 'MS Word 97', 'writer_pdf_Export')...

procedure OOoExport(ArgFrom, ARgTo, ArgFilter : string); Var OpenOffice : Variant; CoreReflection : Variant; PropertyValue : Variant; Document : Variant; OpenDesktop : Variant; LoadParams : Variant; NomFichier : AnsiString; begin //Exportation en PDF ou MS Office (via OOo) OpenOffice := CreateOleObject('com.sun.star.ServiceManager'); OpenDesktop := OpenOffice.createInstance('com.sun.star.frame.Desktop'); LoadParams := VarArrayCreate([0, 0], varVariant);

CoreReflection := OpenOffice.createInstance('com.sun.star.reflection.CoreReflection');

CoreReflection .forName('com.sun.star.beans.PropertyValue') .createObject(PropertyValue);

PropertyValue.Name := 'Hidden'; PropertyValue.Value := True;

LoadParams[0] := PropertyValue;

NomFichier := StringReplace(ArgFrom, '\', '/', [rfReplaceAll, rfIgnoreCase]); Document := OpenDesktop.LoadComponentFromURL( 'file:///'+NomFichier, '_blank', 0, LoadParams);

//Si document texte alors on actualise l'index If (ArgFilter='MS Word 97') or (ArgFilter='writer_pdf_Export') Then Document.getDocumentIndexes.GetByIndex(0).Update;

PropertyValue.Name := 'FilterName'; PropertyValue.Value := ArgFilter;

NomFichier := StringReplace(ArgTo, '\', '/', [rfReplaceAll, rfIgnoreCase]); Document.StoreToURL( 'file:///'+NomFichier, LoadParams);

Document.Dispose; OpenOffice := Unassigned; end;

Si tu veux une version "simplifiée", je t'en fais une.

A+

Fred