CDS454

Print PCL Grid

Last Revised: 10/27/10

This routine can be used to print boxes in a grid similar to a spreadsheet on PCL compatible printers.

CDS454 can print a grid of PCL cells (boxes) that:

See Also:
CDS254 - Print PCL Text, Line, Box, Overlay
CDS354 - Print 2 column PCL Box
CDS554 - Advanced PCL Grid

Calling Format:

CDS454 is called once with the SETUP option, then one or more times without it for each cell (box) to be printed.

CALL "CDS454::SETUP", ERR=XXXX, ATCOL, ATROW, COLS$, ROWS$, { LINEWIDTH }

CALL "CDS454", ERR=XXXX, Y6$, COLNO, ROWNO, { LCR$, TXT$, SHADE, BOXCOLS, BOXROWS, FONTSIZE, VERTADJ, FONTNO, COLOR$, NP$ }

In order to print the cell borders, you must call CDS454 for each cell in the grid, even if there is no text contained within the cell.

SETUP Call
ERR= Take error branch if:
COLS$ was not specified on SETUP call, contains a column width greater than 65,535 dots, or has more than 255 columns.
ROWS$ was not specified on SETUP call, contains a row height greater than 65,535 dots, or has more than 255 rows.
LINEWIDTH exceeds maximum of 255.
ATCOL Column position of upper left box in dots.  There are 300 dots per inch.  Zero is approximately 1/4" in from left of paper.
ATROW Row position of upper left box in dots.  Zero is approximately 1/4" from top of paper.
COLS$ A comma separated list indicating the width of each column.  For example "300,600,75" would indicate 3 columns with widths of 300, 600, and 75 dots.  A zero column width is supported as long as CDS454 is not called with data in that column.  The maximum width of a column is 65,535 dots and the maximum number of columns is 255.  Note that CDS454 adds 30 dots to each column for margin, so COLS$ should be based on the width of the text only (excluding the margin and line width).  You can use CDS262 to compute the width in dots for any text.  Example: "1167,1167" would allow for 2 equal columns with a total width of 2400 dots (8 inches), with 30 dot margin (15 dots left, and 15 dots right), and 2 dot line width, i.e., 2+15+1167+15+2+15+1167+15+2=2400 dots.
ROWS$ A comma separated list indicating the height of each row.  The maximum height of a row is 65,535 dots and the maximum number of rows is 255.  Example: "48,58,58,58" would be appropriate for 1 standard heading row followed by 3 detail rows, each containing one row of text in the cell.  If the last detail row contains two lines of text, then "48,58,58,106" would be appropriate.  ROWS$ should exclude LINEWIDTH dots.

The overall row height in dots including the line height of the cell border line printed above the text, will be the ROWS$ value plus the LINEWIDTH.  With a default LINEWIDTH of 2 dots, the overall row height for the example will be 50, 60, 60, and 108 dots.

Recommended Row Height Formula
Heading/Shaded RowRow Height FormulaExample: 1 row of text in cellExample: 10 rows of text in cell
Yes8 + 40 times the number of lines of text printed in the cell48408
No10 + 48 times the number of lines of text printed in the cell58490
LINEWIDTH Optional parameter that can be passed when you require a line width other than the 2 dots default.  The maximum LINEWIDTH supported is 255.
Cell Call (no ::SETUP)
ERR= Take error branch if:
CDS454 was not called with SETUP before first call without
COLNO is less than 1 or greater than the number of columns specified in COLS$
ROWNO is less than 1 or greater than the number of rows specified in ROW$
Width of COLNO is zero
Y6$ Standard Printer Control String as returned from CDS084
COLNO The column number of the cell within the grid.  The first column is 1, the second column is 2.  The maximum number of columns is 255.
ROWNO The row number of the cell within the grid.  The first row is 1, the second row is 2.  The maximum number of rows is 255.
LCR$ Optional indicator indicating alignment of cell contents
LLeft Justified (default if not passed)
CCentered
RRight Justified
TXT$ The text to be printed inside of box.  Can be null.  Font will shrink to fit box size when necessary.  TXT$ can also contain line feed characters ($0A$) in order to print multiple lines of text inside the same cell/box.
SHADE Optional indicator for shading
0No shading, text prints at 10 point
1Text prints in shaded box using 9 point bold type
BOXCOLS Optional indicator used to indicate that a cell is to be joined with cells to the right of COLNOBOXCOLS of 2 indicates two cells are joined.
BOXROWS Optional indicator used to indicate that a cell is to be joined with cells below ROWNOBOXROWS of 2 indicates two cells are joined.  You may use both BOXCOLS and BOXROWS to create boxes that span both multiple rows and multiple columns.
FONTSIZE Optional parameter to override the default point size of 10 for un-shaded cells, and 9 for shaded cells.  When FONTNO is passed as 4099 for Courier Font, then FONTSIZE represents the characters per inch (pitch) and not the point size.
VERTADJ Optional parameter to override the default vertical position of the text position within the cell.  The default values are 39 dots for un-shaded cells, and 33 for shaded cells.
FONTNO Optional parameter used to override the default font number of 4148.  Typically passed as 4099 when it is necessary to print in a fixed width font such as Courier.  Refer to CDS254 documentation or your printer's internal font list for a list of valid font numbers.
COLOR$ Optional parameter used to change the text color of the cell.  COLOR$ can be a literal color such as 'red', 'green', or 'blue', a hexadecimal RGB color such as FFAA22, or a decimal RGB color as in 128,64,32.  Note that after this cell prints in the color specified, the default color is changed to black.  Refer to CDS254 for additional information about printing in color.
NP$ Optional parameter used to specify Notepad file name and Text ID separated by a comma, i.e., NotepadFileName,TextID.  You can also specify a starting line and ending line line within the notepad text when it is necessary to print only a portion of the notepad, i.e., NotepadFileName,TextID,StartingLine,EndingLine.  The notepad text will print below TXT$ if present.  There is no logic in CDS454 to insure that the notepad text will fit on the page.  Use CDS554 when you require logic to insure the notepad fits on the page.
Examples
1000 GROUP1:

1010 CALL "CDS454::SETUP",1415,300,"460,459","50,60"
1020 CALL "CDS454",Y6$,1,1,"C","Date Printed",1
1030 CALL "CDS454",Y6$,2,1,"C","Customer#",1
1040 CALL "CDS454",Y6$,1,2,"C",DATE(0:"%Ds %Mz/%Dz/%Yz")
1050 CALL "CDS454",Y6$,2,2,"C","123456"
1060 RETURN

1100 GROUP2:
1110 CALL "CDS454::SETUP",1415,500,"30,889","50,60,80,80"
1120 CALL "CDS454",Y6$,1,1,"C","Mark Payment Method",2,2
1130 LET ROW=2
1140 CALL "CDS454",Y6$,1,ROW,""
1150 CALL "CDS454",Y6$,2,ROW,"L","Payment Enclosed"
1160 LET ROW=ROW+1
1170 CALL "CDS454",Y6$,1,ROW,"","",0,1,2
1180 CALL "CDS454",Y6$,2,ROW,"L","Credit Card#:"
1190 LET ROW=ROW+1
1200 CALL "CDS454",Y6$,2,ROW,"L","Expiration Date:"
1210 RETURN

Click for Example Output