INFO: Function Code128Ex and EAN128Ex


With the release of Code128 Fontware 3.0 (April 2005) two new functions are added for creating Code128 and UCC/EAN-128 (now referred as GS1-128) barcodes: Code128Ex and EAN128Ex.

The implementation for the two functions are fairly complicated. As a result, only DLL and COM interfaces are provided. Crystal Reports UFL is also provided.


Backward Compatibility

The two functions are designed to replace Code128Auto and EAN128 functions. The previous implement work in many cases, but may not produce the length-optimized results. Also EAN128 supports numeric data only.


Code128Ex is capable of encoding all ASCII characters as well as extended characters (0x00~0xff). To accommodate this change, we modify the input method by changing it to tilde codes method. Under tilde codes method, you can input a character by using a tilde character (~), followed by lower case letter d and 3-digit ASCII code. For example, you may use ~d000 to input the NUL character, ~d013 for carriage return.

Code128 defines 4 function characters: FNC1, FNC2, FNC3 and FNC4. To input these 4 characters, use ~1, ~2, ~3 and ~4.


The function EAN128Ex turns the open parenthesis into FNC1, and ignores the close parenthesis. Some UCC/EAN-128 implement does not use FNC1 character to separate two adjacent fields. In this case, do not put parentheses in the second data field. For example,


produces two FNC1 characters: the first one is at the beginning of the data (required), and the second one before AI 01. If you do not want to have the second FNC1, enter



Example Code

The internal implement of Code128Ex and EAN128Ex are complicated after taking the possible future extension of Code 128 and UCC/EAN-128 standards into consideration. The following Visual Basic Code demonstrates that how you can call them using COM interface:

Public Function Code128Ex(inpara As String) As String
    Dim encoder As Object
    Set encoder = CreateObject("cruflMorovia.Barcode")
    Code128Ex = encoder.Code128Ex(inpara)
End Function

Public Function EAN128Ex(inpara As String) As String
    Dim encoder As Object
    Set encoder = CreateObject("cruflMorovia.Barcode")
    EAN128Ex = encoder.EAN128Ex(inpara)
End Function