INFORMIX SOFTWARE, INC., LENEXA, KS Wingz Technical Support Bulletin Number 006 Title: Printing a full page chart Date: December 5, 1990 Using hyperscript, you can get a full page print or print preview of a chart without having to manually resize the chart yourself. The following example script will allow you to select a chart and print the chart full page. Print size is assumed for margins of 1 inch top and bottom and .750 inches left and right. Print orientation is landscape, centering is on, and report border is off. To use this script, select a chart, then run the script. If you wish to return to the exact same screen that you have before you run the script, select the upper left hand cell of your screen before selecting the chart to be printed. This script assumes current window scale to be 100%. If not, when window reappears, it will be rescaled to 100%. You can add rescale window commands to the end of the script to rescale if necessary. This script will alter any defined report print range. IMPORTANT: The variable p_opt , set by the dialog box, must be referred to by the script name, a colon, and the variable name, p_opt (ie, Chartpage:p_opt). If you name the script you create anything other than Chartpage , you will need to make the necessary change in the script where it accesses the variable Chartpage:p_opt. If you are running in an environment that has restrictions on file names or name lengths, such as Windows 3.0, you may need to make this change. Also, if attaching script to an object on the worksheet, such as a button, it is advisable to define and refer to the p_opt variable in the sheet script, as variables in scripts attached to objects on a sheet are not accessible as global variables. Example Script: {***this is only an example with no implied warrantees*** ***use at your own risk, make a backup, etc.***} define o,startr,startc,r,c, rh,cw,p_opt { define p_opt where necessary, a s specified in explanation above.} o = number() Select object o if cerror() <> 0 { see if a chart has been selected} message "Select a graph before running script" exit script end if new modal dialog box at (-1,-1) (2 inch, 1.5 inch) add push button "OK" at (.5 inch, 1.1 inch)(1.5 inch,1.35 inch) dialog cancel push button select control 1 dialog default push button script "Chartpage:p_opt = ctvalue(2,0)" add radio button "Page Preview...","Print..." at (.15 inch,.15 inch)(1.85 inch,.9 inch) radio button 2 use dialog box window size (0,0) { window disappears, speeds processing} window scale 1 startr = row() { gets location of last selected cell} startc = col() Copy select Last Cell r = row() c = col() go to cell makecell(c+1,r+1) rh = rowheight() { find current row height} cw = columnwidth() { find current column height} column width 13800 { may be adjusted for different margin sets} row height 9400 { may be adjusted for different margin sets} Paste { creates graph of full page size} Object Location frac(range(makecell(c+1,r+1)),5,5,250,250) Object Name "tempchart" go to cell makecell(c+1,r+1) Report Print Range Hide Headings Message "Set Margins to 1 inch top and bottom, .750 left and right. Set Center ON, Report Border OFF, and orientation to Landscape. (May not be necessary if already properly set.)" Page Setup { set the print options to print correctly} if p_opt = 1 Page Preview end if { act on selected radio button} if p_opt = 2 Print Dialog end if Show Headings Select object "tempchart" Clear select range makerange(c+1,1,c+1,32768) { reset the col and row size} column width cw select range makerange(1,r+1,32768,r+1) row height rh select range range(makecell(startc,startr)) Show Headings repaint on zoom window { window reappears full screen} {end of script}