Hi,
I've written a macro in SPSS (version 18) syntax and it runs hundreds of reports and exports them, I'd had various problems with spacing etc with word and so I've decided to try and change to pdf, only I'm struggling to set it to output the file in landscape and to set the margins etc as it doesn't seem possible to do it in syntax if you're using pdf? Looking through previous posts I've found the following script that Jon Peck wrote: begin program. import SpssClient SpssClient.StartClient( ) doc=SpssClient.GetDesignatedOutputDoc( ) doc.SetPrintOptions(SpssClient.PrintOptions.Orientation, '2') # landscape doc.SetPrintOptions(SpssClient.PrintOptions.LeftMargin, '50') #values in points doc.SetPrintOptions(SpssClient.PrintOptions.TopMargin, '50') doc.SetPrintOptions(SpssClient.PrintOptions.TopMargin, '50') doc.SetPrintOptions(SpssClient.PrintOptions.BottomMargin, '50') SpssClient.StopClient( ) end program. I've copied and pasted the script at the end of my macro, just before: OUTPUT EXPORT /CONTENTS EXPORT=VISIBLE LAYERS=PRINTSETTING MODELVIEWS=PRINTSETTING /PDF DOCUMENTFILE=!QUOTE(!CONCAT("L:\...\",!crsnm,".pdf")). However, it is completely ignored and I get an error message which says that the script is longer than 251 characters. I've spent literally days on this, any help would be much appreciated, really trying to learn python but struggling!! Thanks, Bethany ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Putting a script inside a macro generally
does not work, although there are ways around that. As a first test,
try running the script/program just before the macro and then running
your macro.
HTH, (from France) Jon Peck Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Bethany <[hidden email]> To: [hidden email] Date: 07/07/2011 04:16 PM Subject: [SPSSX-L] Exporting Output to PDF in a macro Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi, I've written a macro in SPSS (version 18) syntax and it runs hundreds of reports and exports them, I'd had various problems with spacing etc with word and so I've decided to try and change to pdf, only I'm struggling to set it to output the file in landscape and to set the margins etc as it doesn't seem possible to do it in syntax if you're using pdf? Looking through previous posts I've found the following script that Jon Peck wrote: begin program. import SpssClient SpssClient.StartClient( ) doc=SpssClient.GetDesignatedOutputDoc( ) doc.SetPrintOptions(SpssClient.PrintOptions.Orientation, '2') # landscape doc.SetPrintOptions(SpssClient.PrintOptions.LeftMargin, '50') #values in points doc.SetPrintOptions(SpssClient.PrintOptions.TopMargin, '50') doc.SetPrintOptions(SpssClient.PrintOptions.TopMargin, '50') doc.SetPrintOptions(SpssClient.PrintOptions.BottomMargin, '50') SpssClient.StopClient( ) end program. I've copied and pasted the script at the end of my macro, just before: OUTPUT EXPORT /CONTENTS EXPORT=VISIBLE LAYERS=PRINTSETTING MODELVIEWS=PRINTSETTING /PDF DOCUMENTFILE=!QUOTE(!CONCAT("L:\...\",!crsnm,".pdf")). However, it is completely ignored and I get an error message which says that the script is longer than 251 characters. I've spent literally days on this, any help would be much appreciated, really trying to learn python but struggling!! Thanks, Bethany ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
In reply to this post by BBH123
Hi Jon,
I've just been told that the reports have to be in word after all so the recipients can copy and paste tables. So I need to give up on pdf. However, I've got issues with editing in word too! I want to have a heading/page title at the top of every page except the first and this heading/page title will change halfway through. TITLE is a bit of a pain as everything has to be perfectly spaced and PAGETITLE seems exactly the same? When my table sizes vary from report to report it's just impossible to work out how putting in blank TITLE ' ' will work, I need proper page breaks! I also have a real problem with the way word will spread tables over multiple pages - it doesn't seem to recognise them the same way as pdf? I downloaded SPSSINC MODIFY OUTPUT and I know it's working as I can get the help to run, but I can't for the life of me get the syntax right for BREAKBEFORETITLES etc, I tried using the example: SPSSINC MODIFY OUTPUT [/PAGEBREAKS BREAKBEFORETITLES=TRUE] TITLELEVEL=TOP but it gave me the following error message: 683 SPSSINC MODIFY OUTPUT Subcommand PAGEBREAKS: BREAKBEFORETITLES must specify a single unquoted string. Any help would be much appreciated! Thanks Bethany ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Administrator
|
Have they never heard of the snap-shot tool in Acrobat?
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by BBH123
To add to my previous message, I've tried using:
SPSSINC MODIFY OUTPUT /PAGEBREAKS BREAKBEFORETITLES=YES. As I found an example online where someone used that, it seems to run it within my macro and it doesn't give me any errors, however it doesn't actually seem to do anything? I've put the command after most of the macro just before the OUTPUT EXPORT part. As for using snapshot in PDF, it's not worth the fight - I was having problems when trying both pdf and word so I'd rather keep everyone happy! Thanks, Bethany ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (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 |
Free forum by Nabble | Edit this page |