sablon
sablon copied to clipboard
image: "auto" property to keep aspect ratio
Hello,
I have multiple different size images and want to create a docx file with
height: auto, width: 100%
. I can specify width in cm or in fixed but that would require additional prior calculations. It would be better if it would be more control.
I tried to specify "keep aspect ratio" in Word and set width only, but it didn't work
Thanks!
Hi @blshkv this may or may not be possible depending on what "sablon needs to know". Do you know if this is as simple as setting the correct WordML property?
Good question. There is such setting in GUI Word interface, so I presumed it should be a relevant WordML property. After quick googling I found this: https://stackoverflow.com/questions/8082980/inserting-image-into-docx-using-openxml-and-setting-the-size There are few promising properties like PresetGeometry and ShapeProperties, but I can't be certain.
If it is not possible, it would be good to have "auto" at least, something like: height: auto, width: 700px
because I know the size of the paper. The value for "auto" should be easy to calculate based on the original size.