Export All IGRAPH to Jpeg of a given size
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | Sub main() Call ExportGraphs("c:\\temp\\test.spo","title") End Sub Sub ExportGraphs(OutputFile As String, TitleStart As String) ' This script comes from SPSS Help ' Declare variables. Dim objOutputDoc As ISpssOutputDoc Dim objOutputItems As ISpssItems Dim objOutputItem As ISpssItem Dim objSPSSIGraph As ISpssIGraph Dim intItemCount As Integer 'number of output items Dim intItemType As Integer 'type of item (see SpssType property) Dim strLabel As String 'Item label ' Open saved output document specified by the OutputFile parameter ' and make it visible. Set objOutputDoc = objSpssApp.OpenOutputDoc(OutputFile) objOutputDoc.Visible = True ' Get Output Items collection. Set objOutputItems = objOutputDoc.Items() ' Iterate through output items. intItemCount = objOutputItems.Count() For Index = 0 To intItemCount - 1 Set objOutputItem = objOutputItems.GetItem(Index) intItemType = objOutputItem.SPSSType() strLabel = objOutputItem.Label ' If item is a chart, modify its title, subtitle, and caption, then ' activate and export it. If intItemType = SPSSIGraph Then Set objSPSSIGraph = objOutputItem.GetIGraphOleObject objSPSSIGraph.DeleteSubtitle objSPSSIGraph.DeleteCaption objSPSSIGraph.Title = TitleStart & " " & Index + 1 objSPSSIGraph.ExportChart "c:\\temp\\mychart100.jpg", "JPEG File", 300, 300, 1, 0 Exit For End If Next Index End Sub |
Related pages
...
Navigate from here