Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How tp print barcodes containing letters
Message
De
20/01/2022 07:32:33
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Titre:
How tp print barcodes containing letters
Divers
Thread ID:
01683294
Message ID:
01683294
Vues:
137
How to print codes

E27H, D18H, F28G, J16H, E19G, G29F, I19F, K09F, L18F

as barcodes from Visual FoxPro application.
I tried code below with Code 128 font but barcodes for those codes are created incorrectly:

StrTo128B('D18H') appears as D18 in printer bar code
StrTo128B('F28G') appears as 228
StrTo128B('J16H') appears as J16

https://i.stack.imgur.com/dCmDb.png

It looks like if StrTo128B() result contains chr(81) and some other characters, those will not appear in output file.

Other bar codes are printed correctly. Use font script is not checked in report designer.

https://i.stack.imgur.com/szZGd.png
    * Converts a string to be printed with
    * True Type Font "PF Barcode 128"
    * Numerics and alphabetic (upper and lower case)
    * If a character is not valid it is replaced by a space
    * USE: _StrTo128B('Codigo 128 B')
    * RETURNS: Character
    
    * http://www.portalfox.com/index.php?name=News&file=article&sid=2600
    FUNCTION StrTo128B(tcString)
      LOCAL lcStart, lcStop, lcRet, lcCheck, ;
        lnLong, lnI, lnCheckSum, lnAsc
      lcStart = CHR(104 + 32)
      lcStop = CHR(106 + 32)
      lnCheckSum = ASC(lcStart) - 32
      lcRet = tcString
      lnLong = LEN(lcRet)
      FOR lnI = 1 TO lnLong
        lnAsc = ASC(SUBS(lcRet,lnI,1)) - 32
        IF NOT BETWEEN(lnAsc,0,99)
          lcRet = STUFF(lcRet,lnI,1,CHR(32))
          lnAsc = ASC(SUBS(lcRet,lnI,1)) - 32
        ENDIF
        lnCheckSum = lnCheckSum + (lnAsc * lnI)
      ENDFOR
      lcCheck = CHR(MOD(lnCheckSum,103) + 32)
      lcRet = lcStart + lcRet + lcCheck + lcStop
      *--- Esto es para cambiar los espacios y caracteres invalidos
      lcRet = STRTRAN(lcRet,CHR(32),CHR(232))
      lcRet = STRTRAN(lcRet,CHR(127),CHR(192))
      lcRet = STRTRAN(lcRet,CHR(128),CHR(193))
      RETURN lcRet
    ENDFUNC
Andrus
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform