QR-Code, DataMatrix & PDF417 Font for use in Microsoft Excel
The 2D XLS font by IDAutomation generates Data Matrix, QR Code, PDF417, and Aztec Barcode Symbols from a single TrueType font within Microsoft Excel Spreadsheets. This font is compatible with all IDAutomation 2D Font Encoders. This font has been tested with Excel 2003, 2010, 2013 and 2016 and should also be compatible with other versions.
Implementation and Tutorial:
- Download the latest version of one of the 2D font packages such as Data Matrix, QR Code or PDF417. This tutorial uses the QR-Code as an example.
- Run the installer for Windows in the package which is the file that ends in EXE.
- After installation in Windows, open the Excel Example which is in the Integration folder. This is the example that will show how the font can be viewed directly in Excel.
- Make a note of the formula that is used to format data to the font by choosing the cell that contains the barcode. Copy and paste this formula into notepad or another text editor so you can use the function later.
- Other Excel files are also included such as the Font Encoder App and a functional Word Mail Merge. The Font Encoder App demonstrates how to display the symbol in a simple Excel VBA program. Any of the examples provided may be customized and used directly. These files may not be available in versions prior to 2020, and in that case, Level 2 Support should be purchased for the associated product to obtain the latest version.
Generating a Barcode in a Custom Spreadsheet
Open Excel and begin setting up the spreadsheet where the first column will
be the Data to Encode and the second column will be the encoded data
formatted for the barcode.
In Windows Explorer, locate the VBA file included in the zip file of the
font package downloaded. For example in the extracted zip file, the macro is found in the Integration folder.
Return back to Excel and select the
Visual Basic option off the
- This will open the Microsoft Visual Basic for Application screen. Select
File - Import File.
Search for the VBA file that was located. This example locates the QR Code VBA, version 2020 naming convention:
The VBA will appear in the modules folder in the Project window:
- Click OK, then File - Close and Return to Microsoft Excel:
- Now, enter the formula copied in step 3 above. In this example, the formula used is =IDAutomation_QRFontEncoder(refer to the cell of data to encode) in the column next to the data to encode. In this example, the formula is entered in
cell B2 and is referencing cell A2 to encode the data.
When the cell to encode is referenced, a string of random characters should appear:
- At this point, the file could be saved with the data encoded for Mail Merge purposes, as the barcode font would be applied after the mail merge had been completed.
- To apply the IDAutomation2D XLS.ttf font from the
download, right-click on the cell and select Format Cells:
Select the IDAutomation2D XLS.ttf font:
If the font was installed prior to beginning the tutorial and the font name appears but the preview of the font does not, please reboot the computer to register the font.
- A very important step to complete on the Alignment tab is to select "wrap
text" under the text control section:
- Click ok, and there should be a barcode in place of the encoded data:
There may be small lines when viewing on the screen in the barcode image but those lines will not appear when the barcode is printed.
- When saving the file, a pop up may appear:
Click No, and select .xlsm extension to save the file as a macro-enabled workbook.
- For additional assistance, refer to the examples included in the integration folder. The examples may also be referred to for troubleshooting purposes to use a process of elimination to narrow down issues.
Excel 2D Font Limitations
Implementation of the 2D XLS font within Excel does have some minor limitations:
- The symbol is only formed properly when the cell it resides in is formatted to "Wrap text" as shown in the image to the right. This is set from the "Format Cells" dialog. The cell must also be sized so that it is wide and tall enough to properly contain the entire symbol.
A very small line gap appears within the symbol because the line spacing property is not adjustable within Excel, and multiple rows are required to generate a 2D barcode. An amplified view of this gap is shown here to the right. IDAutomation's XLS font reduces the line gap to
about 2-5% of the X dimension size, which allows a barcode scanner to
completely overlook and ignore the gap. Even if the gap did cause a scanner
issue, it would be corrected within the scanner because each 2D symbol includes error correction. The line gaps may appear large when viewed on the screen;
however, they are small when printed, especially at 600dpi or greater. The gaps appear larger on lower resolution devices.
The above image shows an amplified view of the Excel line gap with the 2D XLS barcode font.
- A white space will appear at the bottom of the symbol within rows of the spreadsheet, as is shown on the graphic at the top right side of this page. This is because of the way Excel manages the size of this font, which is required to reduce the non-adjustable line spacing.
- Multiple sizes of the 2D XLS font are not possible since this is the only size that has been found to reduce the line gap spacing to an acceptable level.
- This font cannot usually be printed from Excel at less than 8 points, which is an X dimension of about 28 mils or .07CM. Therefore, the symbols can become quite large if much data is being encoded. When using this font within Excel, IDAutomation recommends encoding as few characters as possible.