Bonjour,
Je voudrais exporter une image sans affichage.en fait, je charge
l'image, et j'en change les dimensions.
Par contre je ne trouve pas de pistes pour sauvegarder l'image : je ne
trouve pas comment "passer" l'image au filtre d'export. Le but du jeu
est de redimesionner silencieusement des images générée par l'export en
HTMl de textes writer contenant des formules.
Si quelqu'un avait une idée, je suis preneur ;-)
Voilà le code :
sub retailPics
dim monPath as string
dim caractere as string
dim i as integer
dim position as integer
dim fileGif as string
Dim sGraphicURL As String
Dim sGraphicService As String
' Dim oDrawPages As Object, oDrawPage As Object
Dim oGraphic As Object
Dim aArgs (2) as new com.sun.star.beans.PropertyValue
Dim aURL as new com.sun.star.util.URL
monPath = thisComponent.url
for i = 1 to len(monPath)
caractere = mid(monPath, i, 1)
if caractere="/" then
position = i
endif
next
monPath = left(monpath,position)
fileGif=dir(monPath & "*.gif",0)
do while len(fileGif)>0
sGraphicURL = fileGif
sGraphicService = "com.sun.star.drawing.GraphicObjectShape"
oGraphic = ThisComponent.createInstance(sGraphicService)
oGraphic.GraphicURL = sGraphicURL
Dim TheSize as new com.sun.star.awt.Size
TheSize.width=oGraphic.Size.width*0.8
TheSize.height=oGraphic.Size.height*0.8
oGraphic.setsize(TheSize)
xExporter = createUnoService( "com.sun.star.drawing.GraphicExportFilter" )
xExporter.SetSourceDocument(xSelection)
aURL.complete = fileGif
aArgs(0).Name = "MediaType"
aArgs(0).Value = "image/gif"
aArgs(1).Name = "URL"
aArgs(1).Value = aURL
aArgs(2).Name = "FilterData"
aArgs(2).Value = aFilterData
xExporter.filter( aArgs() )
fileGif = dir
loop
end sub