Options

Exporting text file from Nav 2009 as UTF-8 encoded

Hi Friends,

[For Version: NAV 2009 SP1]

To export UTF-8 encoded text file from Navision the using variable Automation 'Microsoft ActiveX Data Objects 2.8 Library'.Stream

I am trying to export data from NAV 2009 as a text file as UTF-8 encoded using a report. I am getting the output and I need to print in different lines. But it is
displaying continuously.

The code I have done is...
CLEAR(sFileL);
CREATE(sFileL);
sFileL.Open;
sFileL.Charset('UTF-8');
sFileL.WriteText('Texts in line - 1');
sFileL.WriteText('Texts in line - 2');
sFileL.SaveToFile('C:\TextUTF-8.txt');


I am getting the output as below.
01|F|805-9|2011-09-01T12:00:00|03||884.47|0.00|USD|0.08|1025.99||141.52|I|PUE||||P01|0401A|03|BG&0601183W4|BGI GAMING & SYSTEMS, S. DE R.L. DE C.V.|||MEXICO|Blvd. Manuel Ávila Camacho No 32,Piso 12, Oficinas 1203 y 1204,|||Delegación Miguel Hidalgo|Distrito Federal||1100004|CL0000010|PIG930806GL1|PROMOCIONES E INVERSIONES DE GUERRERO, SA PI DE CV|||MEXICO|GUILLERMO GONZALEZ CAMARENA No.600 PISO 9 OFNA. 1,SANTA FE|||DISTRITO FEDERAL|ALVARO OBREGON||01210|05||121015|1|884.47||INSTALLMENT 805-9 OF 12|884.47|884.47|0.0005A|884.47|002|Tasa|0.16|141.5207|002|Tasa|0.16|141.52


But I need the output as below in text file.
01|F|805-9|2011-09-01T12:00:00|03||884.47|0.00|USD|0.08|1025.99||141.52|I|PUE||||P01|04
01A|
03|BG&0601183W4|BGI GAMING & SYSTEMS, S. DE R.L. DE C.V.|||MEXICO|Blvd. Manuel Ávila Camacho No 32,Piso 12, Oficinas 1203 y 1204,|||Delegación Miguel Hidalgo|Distrito Federal||11000
04|CL0000010|PIG930806GL1|PROMOCIONES E INVERSIONES DE GUERRERO, SA PI DE CV|||MEXICO|GUILLERMO GONZALEZ CAMARENA No.600 PISO 9 OFNA. 1,SANTA FE|||DISTRITO FEDERAL|ALVARO OBREGON||01210|
05||121015|1|884.47||INSTALLMENT 805-9 OF 12|884.47|884.47|0.00
05A|884.47|002|Tasa|0.16|141.52
07|002|Tasa|0.16|141.52

Can anyone help me solving this?

Thanks, Aarvi.

Comments

  • Options
    loggerlogger Member Posts: 126
    Hi @Aravindh_Navision ,
    Have already tried to insert carriage return and new line between your lines? Usually, chars #10 and #13.
    Let's go!
  • Options
    Aravindh_NavisionAravindh_Navision Member Posts: 258
    edited 2017-12-12
    Logger, May I know how to do? This is my first attempt, so bit struck up..
  • Options
    AKAK Member Posts: 226
    Create two variables of type "char", assign them the values and add them at the end of the line:
    cr := 13;
    lf := 10;
    sFileL.WriteText('Texts in line - 1' + format(cr) + format(lf));
    .
    .
    .
    
  • Options
    Aravindh_NavisionAravindh_Navision Member Posts: 258
    Thanks a lot Logger and AK.. It worked.. !! :smiley:
  • Options
    loggerlogger Member Posts: 126
    @Aravindh_Navision , you are welcome. :smile:
    @AK , thanks for cooperation!
    Let's go!
  • Options
    NavNabNavNab Member Posts: 181
    @Aravindh_Navision @logger @AK
    Don't bother yourself to handle CrLf manually. Just use this ;)
    sFileL.WriteText('Texts in line - 1', 1);
    sFileL.WriteText('Texts in line - 2', 1);
    sFileL.WriteText('Texts in line - 3');
    
  • Options
    AKAK Member Posts: 226
    @NavNab: Thanks, but I prefer my code do be readable.
Sign In or Register to comment.