Hola,
Aqui tengo una funcion en VB que hace la supuesta transformacion de la cadena de texto a una ca<dena que se puede usar para ponerle un codigo de barras 120c.
Si alguien tiene tiempo y el conocimiento y la puede desifrar se los agradeceria:
Un ejemplo seria este:
Esta cadena 01032001001400 convertida seria esto : ÍÂ@Â!H&zÎ
La funcion en VB es esta:
Public Function Code128c(ByVal DataToEncode As String, Optional ByVal ReturnType As Integer = 0) As String
Dim I As Integer
Dim j As Integer
Dim F As Integer
Dim DataToPrint As String
Dim OnlyCorrectData As String
Dim PrintableString As String
Dim Encoding As String
Dim WeightedTotal As Long
Dim WeightValue As Integer
Dim CurrentValue As Long
Dim CheckDigitValue As Integer
Dim Factor As Integer
Dim CheckDigit As Integer
Dim CurrentEncoding As String
Dim NewLine As String
Dim Msg As String
Dim CurrentChar As String
Dim CurrentCharNum As Integer
Dim C128_StartA As String
Dim C128_StartB As String
Dim C128_StartC As String
Dim C128_Stop As String
Dim C128Start As String
Dim C128CheckDigit As String
Dim StartCode As String
Dim StopCode As String
Dim Fnc1 As String
Dim LeadingDigit As Integer
Dim EAN2AddOn As String
Dim EAN5AddOn As String
Dim EANAddOnToPrint As String
Dim HumanReadableText As String
Dim StringLength As Integer
Dim CorrectFNC As Integer
Dim CID As Integer
Dim FID As Integer
Dim NCID As Integer
NCID = 0
FID = 0
If ReturnType = 6 Or ReturnType = 7 Then NCID = 12000
If ReturnType = 8 Then NCID = 11300
If ReturnType = 9 Then NCID = 11500
If ReturnType = 6 Or ReturnType = 9 Then FID = 11500
If ReturnType = 7 Or ReturnType = 8 Then FID = 11300
If ReturnType <> 0 And ReturnType <> 1 And ReturnType <> 2 Then ReturnType = 0
PrintableString = ""
OnlyCorrectData = ""
StringLength = Len(DataToEncode)
For I = 1 To StringLength
If IsNumeric(Mid(DataToEncode, I, 1)) Then OnlyCorrectData = OnlyCorrectData & Mid(DataToEncode, I, 1)
Next I
DataToEncode = OnlyCorrectData
If (Len(DataToEncode) Mod 2) = 1 Then DataToEncode = "0" & DataToEncode
PrintableString = ChrW(205 + FID)
WeightedTotal = 105
WeightValue = 1
StringLength = Len(DataToEncode)
For I = 1 To StringLength Step 2
CurrentValue = val(Mid(DataToEncode, I, 2))
If CurrentValue < 95 And CurrentValue > 0 Then PrintableString = PrintableString & ChrW(CurrentValue + 32 + NCID)
If CurrentValue > 94 Then PrintableString = PrintableString & ChrW(CurrentValue + 100 + NCID)
If CurrentValue = 0 Then PrintableString = PrintableString & ChrW(194 + NCID)
CurrentValue = CurrentValue * WeightValue
WeightedTotal = WeightedTotal + CurrentValue
WeightValue = WeightValue + 1
If ChrW(CurrentValue + 32 + NCID) = "'" Then PrintableString = PrintableString & "'"
Next I
CheckDigitValue = (WeightedTotal Mod 103)
If CheckDigitValue < 95 And CheckDigitValue > 0 Then C128CheckDigit = ChrW(CheckDigitValue + 32 + FID)
If CheckDigitValue > 94 Then C128CheckDigit = ChrW(CheckDigitValue + 100 + FID)
If CheckDigitValue = 0 Then C128CheckDigit = ChrW(194 + FID)
If ReturnType = 0 Or ReturnType > 2 Then Code128c = PrintableString & C128CheckDigit & ChrW(206 + FID)
If ReturnType = 1 Then Code128c = DataToEncode & CheckDigitValue
If ReturnType = 2 Then Code128c = Str(CheckDigitValue)
End Function