Strange symbol in txt that prevents SEFAZ from reading .txt

-3

I am generating a .txt file with information from an electronic invoice, it is imported into the free government application SEFAZ for note generation.

genexus is generating the .txt file with special characters.

When you do the page break it puts a strange symbol in the txt and this prevents SEFAZ from reading .txt .

I want a procedure to clean these .txt or some other way to fix the problem.

H|7|NF NF: 6155|
I|54| | PAO DE ESPINAFRE|19023000 ||5906|CX |60.0000|97.9200|5875.20| |CX |60.0000|97.9200| | | | |1|||
M
N
N10d|0|400|
Q
Q04|08|
S
S04|08|
W
W02|0.00|0.00|0|0|42980.40|0|0|0|0|0|0|0|0|42980.40|
W23|||||||
X|1||
X03|FELIPPI ARMAZENAGENS LTDA|253175313|25 DE JULHO 870|SC|JARAGUA DO SUL|
X04|00825615000157|
X18||SC||
X26|480||||4212.000|4860.000|
Z||BASE DO CALCULO DO ICMS: 0.00 VALOR DO ICMS: 0.00 EMPRESA OPTANTE PELO SIMPLES NACIONAL
♀

This is an example of the end of a note, after Z, it generates this character

THEN GENEXUS CONVERT MY TEXT MODE REPORT IN A TXT FILE WITH THE NAME THAT I SAVE IN VARIAVEL & ARCHNOM DOWN THE REPORT SOURCE

For Each NotNum
   Where NotNum = &NotNum
      // Capa
      &B = &B +'|'+ Trim(cUF)+'|'+Trim(cNF)+'|'+Trim(NatDesSub)+'|2'+'|'+Trim(cMod)+'|'+Trim(serie)+'|'+Trim(nNF)+'|'+trim(dEmi)+'|'+trim(dSaiEnt)+'|'+trim(hSaiEnt)+'|1'+'|'+Trim(tpNF)+'|'+trim(tpImp)+'|'+trim(tpEmis)+'|'+trim(cDV)+'|'+trim(tpAmb)+'|'+trim(finNFe)+'|'+trim(procEmi)+'|'+trim(verProc)+' |'+'|'+'|'
      &B = Trim(&B)
      &C = &C +'|'+ Trim(xnome)+'|'+'|'+trim(IE)+'|'+'|'+'|'+'|'+'1'+'|'
      &C = Trim(&C)
      &C02 = '|'+ Trim(cnpj)
      &C02 =  Trim(&C02)
      &C05 = &C05 + '|'+ Trim(xLgr)+'|'+trim(nro)+'|'+trim(xCpl)+'|'+trim(xBairro)+'|'+trim(cMun)+'|'+trim(xMun)+'|'+Trim(UF)+'|'+trim(CEP)+'|'+trim(cPais)+'|'+trim(xPais)+'|'+trim(Fone)+'|'
      &C05 = Trim(&C05)
         &X03 = &X03 +'|'+ trim(traxnome)+'|'+trim(traie)+'|'+trim(traxender)+'|'+trim(trauf)+'|'+trim(traxmun)+'|'
         &X03 = trim(&X03)
         &X04 = &X04 +'|'+ Trim(tracnpj)+'|'
         &X04 = trim(&X04)
         &X18 = &X18 +'|'+ trim(traplaca)+'|'+trim(travuf)+'|'+'|'
         &X18 = trim(&X18)
      &E = &E +'|'+ Trim(FxNome)+'|'+Trim(FIE)+'|'+'|'+'|'
      &E = Trim(&E)
      &E02 = &E02 +'|'+ trim(Fcnpj)
      &E02 = trim(&E02)
      &E05 = &E05 +'|'+ Trim(FxLgr)+'|'+trim(Fnro)+'|'+trim(FxCpl)+'|'+trim(FxBairro)+'|'+trim(FcMun)+'|'+trim(FxMun)+'|'+Trim(FUF)+'|'+trim(FCEP)+'|'+trim(FcPais)+'|'+trim(FxPais)+'|'+trim(Ffone)+'|'
      &E05 = Trim(&E05)
      Print capa
      For Each cItem
         Where cImprime = 'S'
         &Item = cItem
         &NotImportada = 'NF '+trim(numnota)
         &NotImportada = trim(&NotImportada)
         &H = &H +'|'+ Trim(str(cItem))+'|'+&NotImportada+'|'
         &H = Trim(&H)
         &vProd = Trim(vProd) + '00000000'
         &I = &I +'|'+ Trim(cProd)+'| '+Trim(cEAN)+'| '+trim(xProd)+'|'+Trim(NCM)+' |'+'|'+trim(CFOP)+'|'+Trim(uCom)+' |'+Trim(qCom)+'|'+Trim(vUnCom)+'|'+trim(vProd)+'|'+' |'+trim(uCom)+' |'+trim(qCom)+'|'+trim(vUnCom)+'| '+'| '+'| '+'| '+'|'+trim(indTot)+'|'+'|'+'|'
         &I = Trim(&I)         
         Do 'N10d'
         Print ITENS
         &H = ''
         &I = ''
     EndFor      
         &W02 = &W02 +'|'+ Trim(totvbc)+'|'+trim(totvicms)+'|'+'0|'+'0|'+trim(totvprod)+'|'+'0|'+'0|'+'0|'+'0|'+'0|'+'0'+'|'+'0'+'|'+'0|'+trim(totvnf)+'|'
         &W02 = trim(&W02)
         &X = &X +'|'+ trim(modfrete)+'|'
         &X = trim(&X)+'|'
         &X26 = &X26 +'|'+ trim(qvol)+'|'+'|'+'|'+'|'+trim(pesol)+'|'+trim(pesob)+'|'
         &X26 = trim(&X26)
         &Z = &Z +'|'+'|'+ 'BASE DO CALCULO DO ICMS: '+ trim(totvbc) + ' VALOR DO ICMS: ' + trim(totvicms) + ' EMPRESA OPTANTE PELO SIMPLES NACIONAL'
         &Z= trim(&Z)
         Print FIM
EndFor

msg('Arquivo TXT gerado com sucesso')

Sub 'N10d'
   &N10d = ''
   &Q04 = ''
   &S04 = ''
   For Each NotNum cItem 
      Where NotNum = &NotNum
      Where cItem  = &Item
      &N10d = &N10d +'|'+'0'+'|'+trim(CST)+'|'
      &N10d = Trim(&N10d)
      &Q04 = &Q04 +'|'+trim(uTrib)+'|'
      &Q04 = trim(&Q04)
      &S04 = &S04 +'|'+ Trim(uTrib)+'|'
      &S04 = Trim(&S04)
      exit
   EndFor
EndSub
//
    
asked by anonymous 20.12.2014 / 13:23

1 answer

1

When a text file is created using "Open For Append", a blank line is always placed below the written line. In this case I use the function below to remove the blank line.


    Private Function RemoverLinhaEmBranco(ByVal sTexto As String)

    Dim i                     As Long
    Dim vtrLinhas()           As String
    Dim strTexto              As String

    vtrLinhas = Split(sTexto, vbCrLf)

    For i = LBound(vtrLinhas) To UBound(vtrLinhas)

        If Trim(vtrLinhas(i))  vbNullString Then
            If i = LBound(vtrLinhas) Then
                strTexto = strTexto & vtrLinhas(i)
            Else
                strTexto = strTexto & vbCrLf & vtrLinhas(i)
            End If
        End If

    Next i

    RemoverLinhaEmBranco = strTexto

End Function

    
15.01.2015 / 23:26