Exporting/Importing S-Plus graphs into Word

Tedesco, Leanna (TEDESCOL@anz.com)
Wed, 25 Feb 1998 09:07:00 +1100


Date: Wed, 25 Feb 1998 09:07:00 +1100
From: "Tedesco, Leanna" <TEDESCOL@anz.com>
Subject: Exporting/Importing S-Plus graphs into Word
To: anzstat@qut.edu.au

Dear colleagues,

Thankyou to all who responded so promptly to my request of importing
S-Plus graphs into Word.
I received a vast number of responses, all of which were greatly
appreciated.  Below is a summary
of these responses.
________________________________________________________________________
___

(1)  Damien Jolley

Rather than use the "cut & paste" through the menu (or keyboard),
you should try the command:
dev.print(file="clipboard", format="metafile")

Then switch Word, and go "Edit>Paste Special>" and paste the metafile
object into your document.

The latest release, S-PLUS V4.0, has a very attractive "export to
Powerpoint"
option which creates a PPT file with your S-PLUS graphics. Cutting and
pasting from Powerpoint into Word is really easy.
________________________________________________________________________
___

(2)  Siva Ganesh

I am using WORD97 and S+ 7.5 on the Win95 OS.

A simple "copy & paste" works fine for me (good quality graphs are
produced) - one thing I do is, after 'copying' the graph (Edit >
Copy or <ctrl> C) in S+ (as it is in the graph window), do a 'paste
special' in WORD97 and choose 'picture' mode instead of the default
'SPLUS....' mode. You can either make the graph 'float' over text or
just insert at the 'cursor' point in WORD!
________________________________________________________________________
___

(3)  Martin Upsdell

   Eps pictures just come across as a grey box in WORD not as the
picture itself.  You may need to have the picture place holders box
ticked in the View sheet of Tools>Options.  They can't be viewed on the
screen but still print out very nicely on a postscript printer.  Word
doesn't decode the postscript, it just passes it on to the printer as
is.  You can resize the picture box quite happily but without being able
to view the picture until it comes out on the printer means its
vritually impossible to do any touch ups on it.
________________________________________________________________________
___

(4)  Alistair Dunn

I use the following function (assuming S-Plus for Windows)..
  copy.plot<-function(width = 10.5, height = 8)
  {
    dev.print(device = win.printer, format = "metafile",
    file =  "clipboard", width = width, height =  height)
  }

This copies as a windows metafile. Then paste as normal in Word.

Also look at

  http://www.math.yorku.ca/Who/Faculty/Monette/S-news/index.html

for an archive of the S-news statistics list discussions. Some
discussion of this topic took place about 18 (?) months ago.

Otherwise, try exporting as a ps file (not eps), then getting the
version of Word (think this may be 7.0a, as against 7.0, as well as
Word 97) that has support for the ps filter.
________________________________________________________________________
___

(5)  David Scott

The suggestion I have, applies if you are using the most recent Word as
I
am, Word 97. I am not sure if it is similar in earlier versions.

If you go to Tools: Options, and select the Veiw Tab, there is a box
marked Picture Placeholders. If it is checked, then graphs will appear
as
just a box (they will print OK, but won't show on the screen). So make
sure it is not checked, and maybe all your problems will disappear. I
have
had no problems in the past with Splus 3 with graphs, but haven't used
Splus 4.

You can either create a file or transfer via the clipboard.
The incantations in Splus 3 are:

Metafile command

win.printer(width = 200, height = 287, format = "placeable metafile",
file = "splus###.wmf", density = 10, units.per.inch = 25.4)

Via the clipboard.

win.printer(file="clipboard",format="placeable metafile",...)
<graphics commands>
dev.off()
________________________________________________________________________
_____

(6)  Peter Thomson

I use the following line successfully:

win.printer(format="metafile",file="clipboard")

Any following graphics will be in the clipboard (in Windows metafile
format), which you can subsequently paste into Word - or any other
document - with its high resolution maintained.  You could substitute
filename.wmf instead of clipboard to save it as a file.
________________________________________________________________________
_____

(7)  Gordon Smyth

>From your message I assume that you are using S-Plus 3 rather than
S-Plus
4.0.  The trouble is that cutting and pasting the S-Plus 3 graphics
window
into Word produces a bitmap file rather than a metafile graphic.  This
takes up a great deal of space and doesn't rescale well.  The solution
is
to use the win.printer command.  This is automated by the clip.plot
function at

  http://www.maths.uq.edu.au/~gks/s/clipplot.html

Then you can do as follows

> win.graph(7,7)
> plot(x,y)
> clip.plot(7,7)    % use the same arguments as in win.graph

Now switch to your Word window, and paste from the clipboard where you
would like to graphic to go.  This will insert the graph in metafile
format, a high resolution format similar to postscript which takes up
about
1/10 of the space of the bitmap.

In S-Plus 4.0, you do not need to use the clip.plot function.  The
graphics
window will cut and paste to Word in metafile by default.
________________________________________________________________________
_____ 

Thankyou again to all.

Leanna Tedesco