Bonjour,

Trouvé un moyen de la faire, utiliser GraphicObjectFillBitmap après avoir inséré l'image.

Dim loImage as Object, loBitmap as Object, loTaille as new com.sun.star.awt.Size
        
Set loImage = goComp.createInstance( "com.sun.star.drawing.GraphicObjectShape")
        With loImage
                .GraphicURL = "file:///C:/Temp/image.jpg"
                .AnchorType = 
com.sun.star.text.TextContentAnchorType.AS_CHARACTER
        End With
        loCellule.insertTextContent( loCellCursor, loImage, false)
        loBitmap = loImage.GraphicObjectFillBitmap
        loTaille = loBitmap.Size
        With loTaille
                .Height = .Height * 2500 \ .Width 'Redimensionne avec maintien 
proportions
                .Width = 2500
        End With
        loImage.setSize( loTaille)

end sub


Mais cette propriété est dépréciée. (Il faudrait utiliser maintenant la propriété Graphic, mais pas encore réussi : https://www.openoffice.org/api/docs/common/ref/com/sun/star/graphic/XGraphic.html )


Le 27/10/2019 à 22:48, Stéphane Santon a écrit :
pour redimensionner l'image ?
- récupérer et modifier les dimensions de l'image ?

En lien une base de test de macro (n'oubliez pas de placer une image C:/Temp/image.jpg ou modifier la ligne 36) :
https://www.cjoint.com/c/IJBvVTcta7Q

- quand je crée l'image et affecte l'URL, la taille est à 100x100 (centièmes de mm), qq soient les proportions de l'image

- quand je l'insère dans le tableau, la taille passe à 101x101

Je n'ai donc aucune info sur l'image à la base... pour la redimensionner.

--
Envoyez un mail à [email protected] pour vous désinscrire
Les archives de la liste sont disponibles à 
https://listarchives.libreoffice.org/fr/users/
Privacy Policy: https://www.documentfoundation.org/privacy

Répondre à