I am trying to insert a bunch of picture files into a
newly created Word document.  I am encountering
trouble setting the Height and Width of the inserted
picture.

The code is really very simple:

###
...set up list_of_doc_files_to_create
wordApp = Dispatch("Word.Application")
for y in list_of_doc_files_to_create:
   wordDoc=wordApp.Documents.Add(y)
   wordRange=wordDoc.Range(0,0).Select()
   ...set up files_to_insert...
   for x in files_to_insert:
      sel=wordApp.Selection.InlineShapes.AddPicture(x)
      per = 25
      sel.Height = int(per*7.481)
      sel.Width  = int(per*5.544)
   wordDoc.SaveAs(y)
   wordDoc.Close()
###

The problems are:

1) The code works for some of the doc files created
but not others (like half and half).  The doc file
gets creaetd fine but the inserted pictures in some of
the files are not scaled.

2) I actually tried to set ScaleHeight but
sel.ScaleHeight didn't work.  That's why I am using
the clumpsy way above.

Any ideas?

Does anybody have more detailed sample code for
dealing with AddPicture?  There are lots of code
samples for inserting other things but I haven't found
anything on AddPicture yet.

Thanks,

--
John
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to