LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 8 Jan 2011 20:10:16 -0500
Reply-To:     Nat Wooding <nathani@VERIZON.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <nathani@VERIZON.NET>
Subject:      Re: DDE, graphics, and MS Word.....
In-Reply-To:  <201101090047.p08BoGZW022035@wasabi.cc.uga.edu>
Content-Type: text/plain; charset="US-ASCII"

Peter

I have never done this sort of thing so I cannot offer direct help. Until someone more knowledgeable can reply, I suggest that you look at the papers posted by Bill Viergever & Koen Vyverman. They are posted at Koen's site http://www.sas-consultant.com/professional/papers.html

Nat Wooding

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Peter Sent: Saturday, January 08, 2011 7:47 PM To: SAS-L@LISTSERV.UGA.EDU Subject: DDE, graphics, and MS Word.....

Hi Folks-

I am a newbie to programming DDE functionality into my SAS programs. I am creating some graphics in SAS (multiples plots into single file using GREPLAY), exporting them as a GIF, and then attempting to insert and adjust them in MS Word.

I have a couple of questions that I'm hoping you can help me with.....

1. My DDE loop is successfully opening word, inserting the GIF into the document, and saving the document.

QUESTION #1: How can I have DDE direct MS Word to "crop" the GIF image to remove the 1" margins on both the left and right side of the GIF image?

2. I need to insert the GIF image in a very specific place in my document.

QUESTION #2: How do I code the DDE to send the GIF image to a specific bookmarked location, which I have defined in MS Word?

Ideally, I wanted to create scalable images using ODS RTF, but I am unable to open the EMF and CGM files that were created using ODS. Apparently, MS Office needs to have new filters installed to accommodate SAS?

BONUS QUESTION: Has anyone ever figured out how to update these filters using Windows 7/MS Office 2003?

Thanks for your help. I really appreciate you guys.

*********************CODE EXAMPLE BELOW**************; %macro ms (market);

/* PROC GPLOT CODE LOCATED HERE.... */

filename output "C:\PHL\Benchmarking_Results_&market..gif"; goptions reset=all rotate=portrait device=gif xmax=8 ymax=9 ftext="TimesNewRoman" gsfname=output gsfmode=replace;

proc greplay igout=work.gseg gout=work.gseg tc=work.tmplt nofs; tdef PK1 1 / llx=0 lly=80 /*first panel*/ ulx=0 uly=100 lrx=100 lry=80 urx=100 ury=100 2 / llx=0 lly=60 /*second panel*/ ulx=0 uly=80 lrx=100 lry=60 urx=100 ury=80 3 / llx=0 lly=40 /*third panel*/ ulx=0 uly=60 lrx=100 lry=40 urx=100 ury=60 4 / llx=0 lly=20 /*fourth panel*/ ulx=0 uly=40 lrx=100 lry=20 urx=100 ury=40 5 / llx=0 lly=0 /*fifth panel*/ ulx=0 uly=20 lrx=100 lry=0 urx=100 ury=20 ; run; quit;

proc greplay igout=work.gseg gout=work.gseg tc=work.tmplt nofs; template PK1; treplay 1:gplot 2:gplot1 3:gplot2 4:gplot3 5:gplot4 ; quit;

options noxsync noxwait xmin; filename sas2word dde 'winword|system'; data _null_; length fid rc start stop time 8; fid=fopen('sas2word','s'); if (fid le 0) then do; rc=system('start winword'); start=datetime(); stop=start+10; do while (fid le 0); fid=fopen('sas2word','s'); time=datetime(); if (time ge stop) then fid=1; end; end; rc=fclose(fid); run;

data _null_; file sas2word; put '[ChDefaultDir "c:\phl\",0]'; put '[FileOpen.Name="Peter"]'; put '[EndOfDocument]'; put '[InsertPara]'; %if &market.=UC %then %do; put '[InsertPicture.Name="Benchmarking_Results_UC.gif"]'; put '[FileSaveAs.Name="Peter_Results_UC",.Format=0]'; %end; %if &market.=SC %then %do; put '[InsertPicture.Name="Benchmarking_Results_SC.gif"]'; put '[FileSaveAs.Name="Peter_Results_SC",.Format=0]'; %end; put '[FileClose]'; put '[FileExit]'; run;

%mend; %ms (UC); %ms (SC);


Back to: Top of message | Previous page | Main SAS-L page