Date: Sat, 28 Mar 2009 05:21:55 +0100
Reply-To: "Trejtowicz, Mariusz" <trejtowicz@onet.eu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Trejtowicz, Mariusz" <trejtowicz@onet.eu>
Subject: Re: import a picture into SPSS output - viewer
In-Reply-To: <472368e10903270738o42604cf7w7131d911e3234a47@mail.gmail.com>
Content-Type: text/plain; charset="us-ascii"
One possible solution for SPSS 17 + installed Python Plug-in is to use
HTML text field:
*** html insert script: lines 2-4 contain script parameters *** .
begin program python.
strText = "<html><img
src=\"http://www.math.yorku.ca/SCS/Gallery/minard/minard-odt.jpg\"
/></html>"
strHeader = "Minard Chart"
intTextHeight = 800
import SpssClient
SpssClient.StartClient()
objOutputDoc = SpssClient.GetDesignatedOutputDoc()
objOutputItems = objOutputDoc.GetOutputItems()
objOutputItem = objOutputItems.GetItemAt(0)
for i in range(objOutputItems.Size()):
objOutputItem = objOutputItems.GetItemAt(i)
if objOutputItem.GetType() == SpssClient.OutputItemType.HEAD:
objHeaderItem = objOutputItem.GetSpecificType()
rangeMin = i
objNewHeader = objOutputDoc.CreateHeaderItem(strHeader)
index = objHeaderItem.GetChildCount()
objHeaderItem.InsertChildItem(objNewHeader,index)
objNewItem = objHeaderItem.GetChildItem(index)
objOutputDoc.ClearSelection()
objNewItem.SetSelected(True)
objOutputDoc.Promote()
objNewItem.SetSelected(False)
for i in range(rangeMin,objOutputItems.Size()):
objOutputItem = objOutputItems.GetItemAt(i)
if objOutputItem.GetType() == SpssClient.OutputItemType.HEAD:
objHeaderItem = objOutputItem.GetSpecificType()
objNewText = objOutputDoc.CreateTextItem(strText)
objHeaderItem.InsertChildItem(objNewText,0)
objTextItem = objHeaderItem.GetChildItem(0)
objTextItem.SetHeight(intTextHeight)
SpssClient.StopClient()
end program.
********* end .
To execute this script you need:
- Python plug-in
- any output window opened
Pros:
- graphs nicely exportable to HTML
Cons:
- objects resize when reopening a saved output
- output window must be refreshed after script execution
- printing, export to other formats (??)
It is also possible to paste an object from clipboard into SPSS output.
This leads to other possibility, unfortunately, capturing an image from
file/web to clipboard might be quite complicated.
BTW, why are you using web service for producing charts?
Best regards,
Mariusz Trejtowicz
-----Original Message-----
From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of
Blaz B
Sent: Friday, March 27, 2009 3:39 PM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: import a picture into SPSS output - viewer
Hi list,
is there a way to display some picture from a location on the hard drive
(or from the web, for that sake) in the SPSS output?
I'd need that since i have a webservice that produces charts from my
initial analysis in SPSS. It would be great to have the results in
Viewer window on demand.
thanks
-blaz
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD