s-news
[Top] [All Lists]

[S] Summary fo graphs in a word document

To: s-news@wubios.wustl.edu
Subject: [S] Summary fo graphs in a word document
From: Karen_Johnson@bdhq.bd.com
Date: Wed, 27 Jan 1999 11:07:04 -0500
Sender: owner-s-news@wubios.wustl.edu
I had posted a question on getting masses of graphs into Word
without individual copying and pasting.  I had also specified,
"Ideally, I would be able to control graph placement on the page
and have one word file encompassing the entire report."  (I
hadn't expected to be able to accomplish the ideal and I am
*****thrilled***** to learn I was wrong!)


Frank Harrell said LaTeX would be ideal for this application.
And said he will post a message about how to get a technical
report I'm finishing on this subject.


Tom Richards and Nick Ellis gave ways of better copying masses of
files.
Tom said,
   If you are using Splus code to generate the graphs (I assume
   that you are), you can pull from the History window the code
   that Splus uses to make a .wmf file, then paste that code into
   your Splus code file and automatically place the graphs in a
   .wmf file.  I use this method regularly to generate Powerpoint
   presentations.
Nick gave clear, detailed instructions that are appended to the
end of this message.


With Robin Regnier's prompting, I investigated updating links
once a template is set up.  It works.  Here's the procedure.

Setting up a template
*  Set up a directory reserved for the template and graphs, (for
this example use "c:\graphs")
*  Create the template graphs in S+.
     graphsheet(file = "c:/graphs/plot###.wmf", format =
"placeable metafile")
     for (i in 1:100){
        plot(0, 0, xlab = '', ylab = '', type = 'n', xaxt = 'n',
   yaxt = 'n')
        text(0, 0, labels = paste('plot', i), cex = 5)
     }
*  Create a dummy Word report, also stored in c:\graphs for
   convenience.
*  Follow Nick's directions to insert the 100 graphs where you
   want them.  Keep the check boxes 'link to file' and 'save with
   document' ON.  Save and close the dummy Word report.

Updating the template
*  Erase the plot###.wmf files in c:\graphs.  (Otherwise S+ will
   start from file plot101.wmf.)
*  Open the dummy Word report.  Go to Edit --> Links.  Select all
   the links and click on 'update now'.
*  Now the new plots are in their positions.  Save the Word file
   to a different location with a different name.  As an extra
   precaution you could also break the links to avoid inadvertent
   updating.
*  Of course if there are less than 100 plots, then erase the
   extra.  If there are more, bring them over in sets of 100.


I am ecstatic this works and grateful to all who helped.
Thanks, KJJ
















Text from Nick's message.
I use wmf format without trouble. Simplest way to get a wmf file
is like
so:

trellis.device(win.printer,file="plot1.wmf",format="placeable
metafile") ...your trellis plotting commands...
dev.off()

If it's not a trellis plot then simply

win.printer(file="plot1.wmf",format="placeable metafile")
...your ordinary plotting commands...
dev.off()

To get say 100 files called plot1.wmf, ..., plot100.wmf into
Word, get
plot1 in in the usual way........

insert|picture|from file and check 'link to file' and (to save
space) uncheck 'save with document'.

Now type alt-F9 and you see the graph as a field. eg
{INCLUDEPICTURE plot1.wmf \* MERGEFORMAT}
The text in this field is directly accessible and can be found
using search (ctrl-F).

To include plot2, just copy and paste the field and change plot1
to plot2. Then go to edit|links, select plot2 and click 'update
now'. Do alt-F9 again to see the graph. If you had done any
formatting to plot1 then this will also be applied to plot2.

To ship to clients you have a choice:
1) send .doc and .wmf's separately. (Example above will find
plot1.wmf
in same directory as .doc file)
2) save all plots in the one .doc file by going to edit|links and
checking 'save with document' for each link or by simply checking
'save with document' on the insert|picture dialog box.


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Summary fo graphs in a word document, Karen_Johnson <=