Native Barcode Generator for LibreOffice & OpenOffice Manual
NOTE: This product supports LibreOffice Version 5 by The Document Foundation
and Apache OpenOffice version 4 and should
also work with other versions that provide VB Macro capability.
Legal Notice: This product is protected by
US Patent 7,637,436 B1. Files containing this technology may only
be distributed outside the licensed organization with the purchase of
a Developer License to the Native Barcode Generator.
The Native Barcode Generator is a custom VB macro module that may
be easily inserted into LibreOffice and OpenOffice to generate barcode images without
any custom fonts, DLLs or external dependencies. It is the complete
barcode generator that stays embedded, even when distributed.
Within this tutorial, Calc is used as the database that performs
the native barcode generation. After Calc is setup in this way, barcodes
may be easily generated within cells, or even entire rows or columns.
As demonstrated in this tutorial, other applications may use Calc as
the data source to display fields and barcodes. Other OpenOffice applications
may also generate barcodes without Calc, if they are able to call the
VB function and return the barcode, which is generated in Unicode UTF-16
- Extract the files from the Native Barcode Generator package.
An example is included and may be used for implementation or testing
- Open the spreadsheet that will contain the barcodes.
Verify the Macro Security Level is set to Medium, which gives the
user the option to confirm if a macro is able to run. To verify
this setting, choose Tools - Options - Security - Macro Security
and to confirm the level is set to Medium and choose OK.
- Choose Tools - Macros - Organize Macros - OpenOffice.org Basic/LibreOffice
- In the 'Macro from' area, click on the name of the desired file
and choose New. This will embed the macros and Visual Basic source
code into the file.
- Remove the 'Sub Main' and 'End Sub' text that are automatically
- Click on the 'Insert Basic Source' button and choose the .bas
file that represents the barcode type that is needed.
This will automatically add the code into the editor window.
- Choose File - Save and File - Exit to exit the VB editor.
- Create an area in the spreadsheet column for the barcode. Size
the column to make sure it is wide enough to contain the entire
barcode. Format the column so that any text appearing in it will
be centered. This is necessary to create the white space (often
called the quiet zone) before and after the barcode.
- If the spreadsheet is going to be used as a data source for
another application, row 1 must contain the title of the fields
as shown in the image below.
- In the cell where the barcode is needed, select the "Courier
New" font (or any other Unicode UTF-16 compliant mono-spaced
font such as "Lucida Console") and change the point size
to 4. If the dialog does not contain this small size, it must be
- Enter the formula in the cell where the barcode is needed. For
example: To generate a Code-128 symbol in cell B2 from data in cell
A2, the formula in cell B2 would be
To generate a Data Matrix symbol, the formula would be
- Optional parameters may be changed
- For linear barcodes only, when changing the "BarHeight"
variable, the size of the cell must also be increased so that
taller barcodes may be contained. The approximate height is
determined by the following formula:
Height in Inches = (Font Size) * (BarHeight) * 0.015
Height in CM = (Font Size) * (BarHeight) *
The default BarHeight is 6.
- If it is necessary to change the X dimension or barcode
width, highlight the barcode field and change the font point
size. The point size must be small, generally 3 or 4 points.
If the size drop down box does not contain these small sizes,
they must be manually typed in. The font selected for the cell
must be "Courier New" or another mono-spaced Unicode
- To create barcodes for other cells in the column, select the
original cell, choose Edit - Copy, select the new cell or cells
and choose Edit - Paste.
- Close the spreadsheet and reopen it to ensure the barcodes are
- Disable AutoCalculate by choosing
Tools - Cell Contents - AutoCalculate.
This is necessary if:
(1) the spreadsheet will be used as the data source for another
application such as Writer or Base;
(2) the spreadsheet
takes too much time to recalculate when it is first opened; or
(3) if many 2D barcodes are being generated.
Every time the spreadsheet is modified, choose Tools - Cell Contents
- Recalculate (or F9) to ensure accuracy within the spreadsheet.
- It is normal to view some distortion such as lines within the
symbol because of low screen resolution. However, the barcodes will
be accurate when printed.
- If a scanner is needed to verify barcodes, IDAutomation offers
barcode scanner kits including
Writer Mail Merge
Within this mail merge tutorial, Calc is used as the database that
performs the native barcode generation.
- After the Calc Installation
is complete, verify AutoCalculate
- Open the Writer document for the Mail Merge.
- Choose Tools - Mail Merge Wizard. Follow the standard process
to start the merge.
- On the Insert Address Block screen of Step 3, click "Select
Address List" and select the Calc spreadsheet that contains
- After the data source is selected, choose Insert - Fields -
Other and insert the fields into the document where they are needed.
The native barcode field should be contained in a table that is
large enough to contain the entire symbol. In this example, a table
of 1 row and 2 columns was created.
- Select the field that will contain the barcode and change the
font to Courier New and change the point size
accordingly. Because the point sizes are so small, they must be
manually typed in.
- Choose Tools - Mail Merge Wizard - Edit Document and verify
the barcode shows properly.
- Follow the standard process to complete the merge as necessary.
Below is a list of the symbologies and the parameters associated.
All parameters are optional except DataToEncode.
ApplyTilde when True or "1", encodes functions
with ~ character. The default value is 1.
BarHeight a numerical value that determines the
height of a linear symbol.
DataToEncode is the data that will be encoded in the
IncludeCheckDigit when True or "1", encodes
the check digit.
N_Dimension is the difference between narrow and wide
CodabarStart start character for Codabar. The letters
A, B C and D are used for start and stop codes.
CodabarStop stop character for Codabar. The letters
A, B C and D are used for start and stop codes.
SpacingNumber is a number that will create spacing to format
text for easier reading.
processTilde when True or "1", encodes functions
with ~ character. The default value is 1.
PreferredFormat generates the symbol size as defined
by the corresponding number as outlined in the .ods file.
EncodingMode is the encoding mode (ASCII, BASE256,
- E_BASE256 = 0
- E_C40 = 1
- E_TEXT = 2
- E_ASCII = 3 (Default)
EccLevel is the Error Correction Level.
ColumnSpecify is the amount of columns for PDF417.
RowSpecify is the amount of rows for PDF417.
PDFTruncate is the truncate PDF417. *
* If these symbologies are needed, IDAutomation can
usually create this product within 3-10 working days with the purchase
of the applicable Linear or Linear + 2D Unlimited Developer License.
IDAutomation support before purchase for verification of specific
Free product support may be obtained by reviewing the knowledgebase
articles that are documented below and by searching resolved
public forum threads. Priority phone, email and forum support is
also provided within 30 days of purchase. Additional phone, email and
forum support is provided with an active
Priority Support and Upgrade Subscription.
Common Problems and Solutions:
- If scanning problems are encountered, verify a printer
of 600 DPI or greater is being utilized. A large point size
such as 5 points must be used with low resolution printers.
IDAutomation also offers many barcode fonts that
print well to low resolution printers.
- The font selected for the object should be "Courier
New," "Lucida Console" or other mono-spaced
- If several small question marks appear instead of a
barcode when creating a PDF for performing other conversions
of the report, it is an indication that the component performing
the conversion is not
Unicode compliant. In this situation, contact the component
vendor to obtain an updated or
- In the event white lines appear in the barcode, highlight
the object and choose Format - Field - Paragraph. Adjust
the line spacing to the largest size that eliminates white
lines in the symbol. Generally, the setting of 0.8 to 0.95
is used for the "Courier New" font.
- 2D Generators provided may generate slowly because of
the complex algorithms used in these symbologies. IDAutomation
recommends encoding 50 characters or less when using these
symbologies. More data may be encoded, although the report
may take longer to generate.
Popular Forum Post Resolutions:
Back to Top