diff --git a/example-makedocument.py b/example-makedocument.py index dfc8c22..ceb40f9 100755 --- a/example-makedocument.py +++ b/example-makedocument.py @@ -19,6 +19,9 @@ # Make a new document tree - this is the main part of a Word document document = newdocument() + + # Make a dict in which you will store image data + imagefiledict = {} # This xpath location is where most interesting content lives body = document.xpath('/w:document/w:body', namespaces=nsprefixes)[0] @@ -68,7 +71,8 @@ # Add an image relationships, picpara = picture(relationships, 'image1.png', - 'This is a test description') + 'This is a test description', + imagefiledict=imagefiledict) body.append(picpara) # Search and replace @@ -109,5 +113,6 @@ # Save our document savedocx(document, coreprops, appprops, contenttypes, websettings, - wordrelationships, 'Welcome to the Python docx module.docx') + wordrelationships, 'Welcome to the Python docx module.docx', + imagefiledict=imagefiledict)