osx - Programmatically find the name of referenced pictures in Word documents -


while writing thesis had somehow renamed 1 of referenced picture files made word tell me not show referenced picture. had long since forgot picture showing... how can find name of referenced picture file?

i running office 2011 on mac, , docx file (openxml).

i don't know vba, after remembering docx zipped xml file came following python solution listing referenced pictures:

import sys,xml.dom.minidom;  zipfile import zipfile;  z=zipfile(sys.argv[1]);  f=z.open("word/document.xml");  doc = xml.dom.minidom.parse(f);  e in doc.getelementsbytagname("pic:cnvpr")];     print e.attributes["name"].value  

if saving word-pictures can call on document:

$ word-pictures ../thesis.docx aurora_screen_reference.png grid2aib.jpg __media-query-css3.tiff __dom_html.tiff aurora_screen_reference.png interaksjonsskisse_science_full_rwd_breaking.png.tiff motivasjonsprisme.png evacprepbackgrnduk1-forside.tiff sattrackingmapa3__bilde.tiff volcgraph-forside.tiff 

another quick solution can use find specific picture preceding string this:

 unzip -p ../thesis.docx word/document.xml \  | xmllint --format /dev/stdin \  | grep -b100 'some string after picture' \  | grep --color  'pic:cnvpr' 

which printed <pic:cnvpr id="1" name="aurora_screen_reference.png"/> in case.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -