You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suspect it translates them into Windows Metafile Format (WMF) and stores them that way. You'd need to try it and then inspect the .docx file (it's a zip archive) and see what the image was that got included. I expect the file extension of the image file name would reliably indicate the underlying file type its stored as.
I guess the documentation is outdated, as this approach does not let me insert an svg into the word document. So I assume the limitation lays with word itself?
Then I need to look into how I can convert svg to png in Python.
It could be your PowerPoint version is not the very latest; I know mine isn't :)
It's still not clear whether the new PowerPoint 2016 supports SVG files natively or whether they are just converted to WMF/EMF and stored that way, like it does with PDF/EPS images.
For anyone else still waiting for the PR, @kuri65536 's code caused a small hiccup in my code. Specifically, _ImageHeaderFactory() is not accounting for valid preceding XML tags. Here is how I fixed it:
Activity
scanny commentedon Jan 21, 2017
Can you do that from the Word application UI?
mrlarssen commentedon Jan 22, 2017
I haven't tried it myself, but it seems like it:
https://support.office.com/en-us/article/Insert-SVG-images-in-Microsoft-Office-69f29d39-194a-4072-8c35-dbe5e7ea528c
scanny commentedon Jan 22, 2017
I suspect it translates them into Windows Metafile Format (WMF) and stores them that way. You'd need to try it and then inspect the .docx file (it's a zip archive) and see what the image was that got included. I expect the file extension of the image file name would reliably indicate the underlying file type its stored as.
mrlarssen commentedon Jan 23, 2017
I guess the documentation is outdated, as this approach does not let me insert an svg into the word document. So I assume the limitation lays with word itself?
Then I need to look into how I can convert svg to png in Python.
Thanks for your response.
scanny commentedon Jan 23, 2017
This page has some insights on why it might not be working for you:
https://www.quora.com/How-would-you-insert-a-svg-file-in-PowerPoint
It could be your PowerPoint version is not the very latest; I know mine isn't :)
It's still not clear whether the new PowerPoint 2016 supports SVG files natively or whether they are just converted to WMF/EMF and stored that way, like it does with PDF/EPS images.
ftomassetti commentedon Jul 30, 2020
A PR related to this is pending #798
kuri65536 commentedon Aug 11, 2020
Thank you to python-docx, this is very useful software.
I had done to embed svg images with python-docx.
this is a part of my
mkdocs-theme-topdf .
code is here
BTW, I found the PR and this is just a sample workaround for
the current version.
(this preview from Word android)
scanny commentedon Aug 11, 2020
Nice, @kuri65536, thanks for posting this :)
tikuma-lsuhsc commentedon Apr 27, 2021
@kuri65536 - Thanks for the nice workaround!
For anyone else still waiting for the PR, @kuri65536 's code caused a small hiccup in my code. Specifically,
_ImageHeaderFactory()is not accounting for valid preceding XML tags. Here is how I fixed it:cristianocca commentedon Jun 14, 2021
It's been some time, any news or actual guide how to add an svg image to the docx template file?
jfthuong commentedon Mar 17, 2022
If it might help,
Here are 2 Word with a similar image in PNG and SVG that have been added in the same place.
I have also extracted the files and pretty-formatted the XML files for easier comparison
png_vs_svg.zip
Add basic support for adding SVG pictures to docx files
takis commentedon Jun 24, 2022
Hi,
I had a first try at implementing this, but have only tested using simple SVGs. The files open without issues in Word on my Mac Mini.
Any feedback welcome. I haven't written any tests yet.
Add basic support for adding SVG pictures to docx files
Add basic support for adding SVG pictures to docx files
Add basic support for adding SVG pictures to docx files
Add basic support for adding SVG pictures to docx files