Você está na página 1de 5

1. Escribir el cdigo numrico de 12 dgitos. 2.

Aplicar el siguiente algoritmo para calcular el dgito de control y una cadena de texto:
Public Function ean13$(chaine$) 'V 1.0 'Paramtres : une chaine de 12 chiffres 'Retour : * une chaine qui, affiche avec la police EAN13.TTF, donne le code barre ' * une chaine vide si paramtre fourni incorrect Dim i%, checksum%, first%, CodeBarre$, tableA As Boolean ean13$ = "" 'Vrifier qu'il y a 12 caractres If Len(chaine$) = 12 Then 'Et que ce sont bien des chiffres For i% = 1 To 12 If Asc(Mid$(chaine$, i%, 1)) < 48 Or Asc(Mid$(chaine$, i%, 1)) > 57 Then i% = 0 Exit For End If Next If i% = 13 Then 'Calcul de la cl de contrle For i% = 2 To 12 Step 2 checksum% = checksum% + Val(Mid$(chaine$, i%, 1)) Next checksum% = checksum% * 3 For i% = 1 To 11 Step 2 checksum% = checksum% + Val(Mid$(chaine$, i%, 1)) Next chaine$ = chaine$ & (10 - checksum% Mod 10) Mod 10 'Le premier chiffre est pris tel quel, le deuxime vient de la table A CodeBarre$ = Left$(chaine$, 1) & Chr$(65 + Val(Mid$(chaine$, 2, 1))) first% = Val(Left$(chaine$, 1)) For i% = 3 To 7 tableA = False Select Case i% Case 3 Select Case first% Case 0 To 3 tableA = True End Select Case 4 Select Case first% Case 0, 4, 7, 8 tableA = True End Select

Case 5 Select Case first% Case 0, 1, 4, 5, 9 tableA = True End Select Case 6 Select Case first% Case 0, 2, 5, 6, 7 tableA = True End Select Case 7 Select Case first% Case 0, 3, 6, 8, 9 tableA = True End Select End Select If tableA Then CodeBarre$ = CodeBarre$ & Chr$(65 + Val(Mid$(chaine$, i%, 1))) Else CodeBarre$ = CodeBarre$ & Chr$(75 + Val(Mid$(chaine$, i%, 1))) End If Next CodeBarre$ = CodeBarre$ & "*" 'Ajout sparateur central For i% = 8 To 13 CodeBarre$ = CodeBarre$ & Chr$(97 + Val(Mid$(chaine$, i%, 1))) Next CodeBarre$ = CodeBarre$ & "+" 'Ajout de la marque de fin ean13$ = CodeBarre$ End If End If End Function

3. Una vez que se obtiene la cadena de texto que contiene el dgito de control, se aplica la fuente Code EAN13 del archivo EAN13.TTF al texto Algunos algoritmos ignoran los dgitos que vienen despus del 12. Lo calcula internamente.

Aeromium Barcode Fonts


EAN13 Barcode
The European Article Numbering system encodes a 13-digit number into the barcode. This is

the international barcode that you see on retail items in the supermarkets. EAN13 is also considered the modern version of UPCA as the 13 digits are designed to be a superset of the 12digit UPCA.

Generating this barcode using the Barcode Maker


The easiest way to create this barcode is to use the Barcode Maker included in the installation package. Simply goto the Start Menu and launch Aeromium Barcode Fonts > Barcode Maker. This software automates and simplifies the creation of the barcodes for you. After the barcode is created, you can simply copy and paste the barcode into your documents. Generating this barcode using the Barcode Maker Generating this barcode in Excel

EAN13 Barcode Fonts


The following is the list of fonts with varying heights supported by Aeromium. FontCodeEANH1.ttf FontCodeEANH2.ttf FontCodeEANH3.ttf (Default Font) FontCodeEANH4.ttf FontCodeEANH5.ttf FontCodeEANH6.ttf The following is the list of fonts that support the Extended version of the EAN13 barcode. FontCodeEANEH1.ttf FontCodeEANEH2.ttf FontCodeEANEH3.ttf (Default Font) FontCodeEANEH4.ttf FontCodeEANEH5.ttf FontCodeEANEH6.ttf

Using this Barcode Manually


The EAN13 barcode uses a Parity table to generate the barcode and the calculation of the barcode font characters involves certain amount of complexity. It is thus recommended to use the Barcode Maker or Excel Add In to generate the barcodes instead of creating them manually.

Sample Barcodes
To encode the data "612345678912" for the EAN13 barcode, simply key in "612345678912" in the Barcode Maker. The output is as follows :

Selecting the Extended Style results in the following barcode :

Copyright(c) 2009 Aeromium Barcode Fonts. All Rights Reserved.