Add barcodes and QR codes in documents

Prev Next

Exact Forms Plus can turn a field's value into a barcode or QR code in the document, for example a QR code that opens the record in Quickbase, a Code 128 barcode with an order number, or an EAN-13 product code. You add barcodes to the main part of a template with a function, and to embedded reports with a column type.

For the other functions you can use in a template, see Template fields and functions.

Add a barcode to the template

In the Word template, type the function where the barcode should appear, on its own line:

~=barcode(f[field ID],type,widthxheight)~

Part

What to enter

Example

f[field ID]

The field whose value the barcode holds. The field must be in the template's clist. You can also use ~Field Name~-style references or type a fixed value.

f[123]

type

The kind of barcode, from the table below. Not case-sensitive. For linear barcodes, add -t or -b to show the value as text (see Show the value as text).

qrcode, code128-b

widthxheight

The size, as two numbers separated by a lowercase x. Required. See Size.

50x50

For example, ~=barcode(f[123],qrcode,50x50)~ creates a QR code from the value of field 123 on the master record.

  • Type ~=barcode( exactly like this, in lowercase and with no space before the parenthesis. Otherwise the function isn't recognized and stays in the document as typed.

  • Spaces after the commas are fine.

  • The barcode replaces the line it's on and uses that line's alignment (left, centered, or right), so put it on its own line, or in its own Word table cell next to other content.

Barcode types

Barcode

type

Kind

Characters

Length

Example

QR Code

qrcode

2D

Text, numbers, and URLs

Variable

~=barcode(f[258],qrcode,50x50)~

Data Matrix

datamatrix

2D

All ASCII characters

Variable

~=barcode(f[102],datamatrix,50x50)~

PDF417

pdf417

2D

Letters, numbers, punctuation

Variable

~=barcode(f[262],pdf417,150x50)~

Code 39

code39

Linear

0–9, A–Z, space, - . $ / + %. Lowercase letters are converted to uppercase.

Variable

~=barcode(f[3],code39,50x50)~

Code 39 Extended

code39extended

Linear

0–9, A–Z, a–z

Variable

~=barcode(f[102],code39extended,50x50)~

Code 93

code93

Linear

0–9, A–Z, space, - . $ / + %. Lowercase letters are converted to uppercase.

Variable

~=barcode(f[3],code93,50x50)~

Code 93 Extended

code93extended

Linear

All 128 ASCII characters

Variable

~=barcode(f[3],code93extended,50x50)~

Code 11

code11

Linear

0–9 and -

Variable

~=barcode(f[260],code11,50x50)~

Codabar

codabar

Linear

0–9 and - $ : / . +

Variable

~=barcode(f[3],codabar,50x50)~

Code 32

code32

Linear

0–9

8 digits

~=barcode(f[259],code32,50x50)~

Code 128

code128

Linear

0–9, A–Z, control characters, and most punctuation

Variable

~=barcode(f[3],code128,50x50)~

Code 128A

code128a

Linear

Uppercase letters A–Z, digits 0–9, punctuation, and control characters (no lowercase)

Variable

~=barcode(f[3],code128a,50x50)~

Code 128B

code128b

Linear

Uppercase and lowercase letters, digits 0–9, and punctuation

Variable

~=barcode(f[3],code128b,50x50)~

EAN-8

ean8

Linear

0–9

7 or 8 digits

~=barcode(f[259],ean8,150x75)~

EAN-13

ean13

Linear

0–9

12 or 13 digits

~=barcode(f[261],ean13,200x100)~

Exact Forms Plus doesn't check the value before creating the barcode. If the value has characters or a length the barcode type doesn't allow, the document shows an error in place of the barcode (see If the barcode doesn't appear).

Show the value as text

For linear barcodes, add a suffix to the type to print the value as readable text:

In the template

Result

~=barcode(f[123],code39,100x50)~

Barcode only (default)

~=barcode(f[123],code39-t,100x50)~

Text above the barcode

~=barcode(f[123],code39-b,100x50)~

Text below the barcode

The suffix is ignored for 2D barcodes (QR Code, Data Matrix, PDF417).

Size

Always give both numbers, separated by a lowercase x, for example 50x50. An uppercase X or a single number causes an error.

  • QR Code and Data Matrix: use the same number twice, for example 50x50 or 80x80. The larger the number, the larger the code.

  • Linear barcodes and PDF417: the size in the document may not match the numbers exactly. Create a test document and adjust the numbers until the barcode is the size you need and scans reliably.

Example: a QR code that opens the record

  1. On the master table, create a formula URL field, for example Record Link, with this formula:

    URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]
  2. In the template, add ~=barcode(f[258],qrcode,80x80)~, using the field ID of Record Link instead of 258.

  3. Add the field to the template's clist with the EFP Configurator, and attach the template to its record again.

  4. Create a document. Scanning the QR code opens the record in Quickbase (the person scanning must be able to sign in and view the record).

Barcodes in embedded reports

To show a barcode in each row of an embedded report, set up a column in the subtable configurator:

  1. On the Subtable Fields tab, set the column's Type to Bar Code.

  2. Select Advanced Settings on the row. Under Bar Code Properties, choose the Bar Code Type, and set Bar Code Width and Bar Code Height (default 50 each).

  3. For linear barcodes, choose a Bar Code Text Location: None, Top, or Bottom. It isn't shown for QR Code, Data Matrix, and PDF417.

  4. Select Apply Field Changes, then Save.

In embedded reports, the barcode is shown at the width and height you set, and a row with an empty value gets an empty cell. Values can contain commas. For the rest of the configurator, see Insert embedded reports (subtable).

Rules and limits

  • No commas in the value (main part of the template). The function's parts are separated by commas, so a value such as 1,234 or a URL with a comma causes an error. Use a formula field that removes the commas.

  • No tildes (~) in the value. A tilde ends the function early.

  • Plain text values only. A field with Allow some HTML tags to be interpreted turned on is inserted as HTML, so it can't be used for a barcode. Use a formula text field without HTML instead.

  • The field must be in the clist. Otherwise the barcode encodes the text f[123] instead of the field's value.

  • Barcode functions don't work in mailing label templates.

If the barcode doesn't appear

What you see

What to do

The function appears as typed, for example ~=Barcode(f[123],qrcode,50x50)~

Type ~=barcode( in lowercase, with no space before the parenthesis.

ERROR: There is a comma in the barcode value, commas are not supported.

The value contains a comma. Use a field without commas.

ERROR: Barcode Type Not Supported: followed by the type

The type is misspelled. Use a type from the table.

BARCODE ERROR or BARCODE ERROR: followed by a message

The size is missing or wrong. Use two numbers with a lowercase x, for example 50x50.

ERROR: followed by a message, or ERROR: No Barcode Image was created from followed by the value

The value doesn't fit the barcode type, for example letters in an EAN-13 code or the wrong number of digits. Check the value, or choose a type that allows those characters.

The barcode scans as f[123]

The field isn't in the template's clist. Add it with the EFP Configurator.

ERROR: Barcode Type Not Supported: code218a in an embedded report

The Code 128A option in the configurator doesn't work at the moment. Choose Code 128 or another type.

If you still need help, open a technical support case.

See also: Template fields and functions, Insert embedded reports (subtable), Exact Forms Plus document templates.