Date: Thu, 16 Nov 2000 10:56:49 -0600
Reply-To: "Bauer, John" <bauer@SPSS.COM>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: "Bauer, John" <bauer@SPSS.COM>
Subject: Re: script for inserting page breaks in crosstab output?
Ruth et al,
I have appended a script which simply puts a page break on each heading.
Although there may be a few extra pages printed (e.g. the word "Crosstabs"
will appear on a page by itself) it should reasonably approximate the
desired effect.
Open a script window, paste in the script below, and save as
"PageBreakHeading.sbs" or something similar.
John Bauer, Ph.D.
SPSS Developer Support
----------------------------------------------------------------
visit the SPSS Script eXchange:
http://www.spss.com/tech/scptxchg/
----------------------------------------------------------------
'Begin Description
'Sets page breaks on each Heading in the output.
'This should be effective when SPLIT FILE SEPARATE BY group is chosen.
'End Description
Sub Main
'Purpose: add page breaks to output
'Assumptions: there is an open Output Doc (Navigator)
'Effects: places Page Break on each Heading
'Return Values: none
Dim objOutputDoc As ISpssOutputDoc ' Output document
Dim objItems As ISpssItems ' Output Navigator
items
Dim i As Integer
' Get designated document only if there is at least one output
document.
' Omitting this test results in a error message.
If objSpssApp.Documents.OutputDocCount > 0 Then
'Get the currently designated output document.
Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc
Else
'If no navigator window exists, quit the script.
'comment the following line out and the script will go away
silently.
MsgBox "Please open an output window before running this
script.", _
vbExclamation, "Script Error"
Exit Sub
End If
' Get the outline tree from the Navigator.
Set objItems = objOutputDoc.Items
' Get each item in the Navigator.
For i = 0 To objItems.Count - 1
Set objItem = objItems.GetItem(i) 'Get each item in
turn.
If objItem.SPSSType = SPSSHead Then 'Check to see if
it's a Heading
objItem.PageBreak = True 'attach a
page break if so
End If
Next
End Sub
-----Original Message-----
From: Ruth Oberhausen [mailto:ruth.oberhausen@DGN.DE]
Sent: Thursday, November 16, 2000 3:28 AM
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: script for inserting page breaks in crosstab output?
Dear members,
my problem goes as follows.
I have a cross table analysis on a splitted file, so that I get the same
type of table for more than 100 different institutions. Whenever a new
table is created in the output, I'd like to insert a page break after
the display of the summary of data table. So far I have to do it
manually but this gets pretty tedious by more than 100 different
variable values of the splitted variable and serval different crosstabs
to be created. Does anybody know of an existing script that solves this
problem?
Thanks in advance