rebol [ Title: "Word Picture" File: %word-picture.r Date: 30-Jun-2006 Version: 1.0.0 Progress: 0.6 Status: "working" Needs: [] Author: "Anton Rolls" Language: "English" Purpose: {Add an image file to a Word document.} Usage: {} History: [ 1.0.0 [30-Jun-2006 {First version, converted from Ben's} "Anton"] ] ToDo: { - } Notes: {I don't think the rotation property works with Pictures} ] if error? set/any 'error try [ do/args %../COMLib.r [ ; Use the COMLib API functions here word_obj: createObject "Word.Application" PutValue [word_obj ".Visible = %s" "TRUE"] word_doc: GetObject [word_obj ".Documents.Add"] CallMethod [word_obj ".Selection.TypeText(%s)" "Show me some cool Images !"] objShapes: GetObject [word_doc ".Shapes"] save/png %demos/logo.png logo.gif ; save an image file Shape: GetObject [objShapes ".AddPicture(%s)" to-local-file clean-path %demos/logo.png] PutValue [Shape ".width = %d" 100] ;PutValue [word_doc ".Shapes(%d).width = %d" 1 100] ;release Shape ;Shape: GetObject [objShapes ".AddShape(%d, %d, %d, %d, %d)" 1 50 100 200 100] ; 1 = msoShapeRectangle ;PutValue [Shape ".Rotation = %d" 20] ;PutValue [word_doc ".Shapes(%d).rotation = %d" 2 20.5] release Shape release objShapes release word_doc release word_obj ] ][ print mold disarm error ]