home *** CD-ROM | disk | FTP | other *** search
- /* --------------------------------------------- */
- /* Final Data ARexx Macro. */
- /* SetColumnWidth: This macro will adjust the */
- /* width of each selected column so that when */
- /* printed all of the data in the column will */
- /* be printed. */
- /* */
- /* $VER: SetColumnWidth 1.2 (8.3.95) */
- /* © 1995 SoftWood, Inc. */
- /* */
- /* This macro is useful because the font used on */
- /* screen is proportional, whereas the printed */
- /* font is non-proportional (mono-spaced). This */
- /* makes it difficult to know how wide to make */
- /* the column so that all the data will get */
- /* printed. Without this macro it's all done by */
- /* trial and error. */
- /* */
- /* Changes: */
- /* V1.1 Initial version for Final Data. */
- /* v1.2 Modified for Final Data R2 to support */
- /* non-contiguous column selection. Also */
- /* has options to reselect columns. */
- /* --------------------------------------------- */
- OPTIONS RESULTS
-
- reselect = 0 /* 1 to reselect columns after sizing them */
- /* 0 to leave columns unselected. */
-
- SelectionInfo
- PARSE VAR RESULT selType fromCol toCol
-
- IF ( selType = 'COLUMNS' ) THEN DO
-
- NumRows
- nrows = RESULT
- IF ( nrows > 0 ) THEN DO
-
- /* Determine which columns are selected. */
- DO c = fromCol TO toCol
- IsColumnSelected c
- columnSelected.c = RESULT
- END
-
- /* Change the widths of selected columns. */
- DO c = fromCol TO toCol
- IF ( columnSelected.c ) THEN DO
- GetColumnName POSITION c
- maxlen = LENGTH(RESULT)
-
- DO r = 1 TO nrows
- CellData c r
- len = LENGTH(RESULT)
- IF ( len > maxlen ) THEN
- maxlen = len
- END /* do to nrows */
-
- pixels = (maxlen * 8) + 1
- IF ( pixels > 640 ) THEN
- pixels = 640
- GetColumnID POSITION c
- InitModifyColumn RESULT
- DefineColumn WIDTH pixels
- ModifyColumn
- END
-
- END /* DO to toCol */
-
- IF ( reselect ) THEN DO
- /* Reselect the columns. */
- DO c = fromCol TO toCol
- IF ( columnSelected.c ) THEN DO
- SelectColumn c EXTEND
- END
- END
- END
-
- END
-
- END