I started by looking at the labelary and zebra docs, which each provide essentially a very large table of keys and values.
I did a bunch of googling and couldn't come up with anything particularly convenient.
I even thought to download the driver for a printer in zebra and print a google sheet to that printer, but that started taking too long and feeling out of the way.
So, eventually, I just used the example in labelary. The 4th section of the example is basically a table with one row and two cells, so I went with that to get the basic idea down and extrapolated from there.
This produced a table with one row and two columns.
^XA
^FO50,900^GB700,250,3^FS
^FO400,900^GB1,250,3^FS
^CF0,40
^FO100,960^FDShipping Ctr. X34B-1^FS
^FO100,1010^FDREF1 F00B47^FS
^FO100,1060^FDREF2 BL4H8^FS
^CF0,190
^FO485,965^FDCA^FS
^XZ
Which indicates, referencing the docs [1]:
XA -> begin doc // start format
FO -> x, y alignment // field origin
GB -> width, height, thickness, color, rounding // graphic box
FD -> data // field data
FS // field separator
CF -> fontName, height, width // change default font
XZ -> end doc // end format
Assume
- 203 dpi -> 203 dots per inch
- all units are in dots
So the same ZPL with variables would be something like:
^XA
^FO{ labelPadding },{ labelPadding + rowNumber\*rowHeight }^GB{ tableWidth },{ rowHeight },{ borderWidth }^FS
^FO400,900^GB1,250,3^FS
^CF0,40
^FO100,960^FDShipping Ctr. X34B-1^FS
^FO100,1010^FDREF1 F00B47^FS
^FO100,1060^FDREF2 BL4H8^FS
^CF0,190
^FO485,965^FDCA^FS
^XZ
config vars:
- labelWidth (default: 4 inches)
- labelHeight (default: 6 inches)
- printDensity (default: 8 dpmm -> 203dpi)
- labelPadding (default: 50 dots)
- borderWidth: (default: 3 dots)
- titleFontSize (default: calculated as half row height, in dots)
- cellFontSize (default: calculated as half row height, in dots)
- titleRowHeight (default: calculated as equal to cell height)
inferred vars (from column titles/rows object array)
- number of columns (2)
- number of rows (1)
calculated vars
- rowHeight = (labelHeight - labelPadding*2)/(1+numberRows)
- tableWidth = labelWidth - 2*labelPadding
- title font size
- title font weight
- Create opening
- Create border box
- Create vertical separators
- Create horizontal separators
- Fill in content
- Create closing
^XA
^FO50,50^GB700,250,3^FS
^FO400,50^GB1,250,3^FS
^CF0,40
^FO100,100^FDShipping Ctr. X34B-1^FS
^FO100,160^FDREF1 F00B47^FS
^FO100,210^FDREF2 BL4H8^FS
^CF0,190
^FO485,115^FDCA^FS
^XZ
^XA
^FO50,50^GB700,500,3^FS
^FO400,50^GB1,500,3^FS
^FO50,300^GB700,1,3^FS
^CF0,40
^FO100,100^FDShipping Ctr. X34B-1^FS
^FO100,160^FDREF1 F00B47^FS
^FO100,210^FDREF2 BL4H8^FS
^CF0,190
^FO485,115^FDCA^FS
^XZ
^XA
^FO50,50^GB700,500,3^FS
^FO283,50^GB1,500,3^FS
^FO516,50^GB1,500,3^FS
^FO50,300^GB700,1,3^FS
^CF0,40
^FO100,100^FDOrder 1287^FS
^FO100,160^FDREF1 F00^FS
^FO100,210^FDREF2 BAR^FS
^FO333,100^FDOrder 1287^FS
^FO333,160^FDREF1 F00^FS
^FO333,210^FDREF2 BAR^FS
^FO566,100^FDOrder 1287^FS
^FO566,160^FDREF1 F00^FS
^FO566,210^FDREF2 BAR^FS
^FO100,350^FDOrder 1287^FS
^FO100,410^FDREF1 F00^FS
^FO100,460^FDREF2 BAR^FS
^FO333,350^FDOrder 1287^FS
^FO333,410^FDREF1 F00^FS
^FO333,460^FDREF2 BAR^FS
^FO566,350^FDOrder 1287^FS
^FO566,410^FDREF1 F00^FS
^FO566,460^FDREF2 BAR^FS
^XZ