Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image: "auto" property to keep aspect ratio #161

Open
blshkv opened this issue Jun 21, 2020 · 2 comments
Open

image: "auto" property to keep aspect ratio #161

blshkv opened this issue Jun 21, 2020 · 2 comments

Comments

@blshkv
Copy link

blshkv commented Jun 21, 2020

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!

@stadelmanma
Copy link
Collaborator

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?

@blshkv
Copy link
Author

blshkv commented Jul 1, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants