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.1 (23.11.94) */
- /* */
- /* 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. */
- /* --------------------------------------------- */
- OPTIONS RESULTS
-
- SelectionInfo
- PARSE VAR RESULT selType fromCol toCol
-
- IF ( selType = 'COLUMNS' ) THEN DO
-
- GetPrintPrefs PITCH DEVICE
- PARSE VAR RESULT prefsPitch prefsDevice
- pitch = 10
- IF ( prefsDevice = 'Printer' ) THEN DO
- SELECT
- WHEN ( prefsPitch = 'Pica' ) THEN DO
- pitch = 10
- END
- WHEN ( prefsPitch = 'Elite' ) THEN DO
- pitch = 12
- END
- WHEN ( prefsPitch = 'Fine' ) THEN DO
- pitch = 15
- END
- OTHERWISE DO
- END
- END /* Select */
- END
-
- NumRows
- nrows = RESULT
- IF ( nrows > 0 ) THEN DO
-
- DO c = fromCol TO toCol
-
- 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 /* do to toCol */
-
- END
-
- END