Display Text BLOB in Word Layout

Hello,

I am working on extensions for NAV2018.

I tried to show a Text from a BLOB field in a Word Layout. But I am having the following result :

6qe297dgvjqo.png


I used a "Repeating" Content Control in the Word Layout and CalcFields in the trigger OnAfterGetRecord() :

4ptiibs9xcbv.png


Thanks in advance.

Best Answer

  • MelekBoujelbeneMelekBoujelbene Member Posts: 17
    Answer ✓
    Hi,

    The solution that I found is using a Text field that I fill with InStream
    trigger OnAfterGetRecord();
                var
                    locCalculLoyerEntete : Record "Calcul Loyer Entete";
                    osInStream : InStream;
                    sLine : Text;
                    sCrLf : Text;
                    cCr : Char;
                begin
                    locCalculLoyerEntete.Get("No.");
                    locCalculLoyerEntete.CalcFields("Documents Manquants");
                    // Transform BLOB "Documents Manquants" to Text in sDocsManquants
                    sDocsManquants:='';
                    sLine:='';
                    cCr:=10;
                    sCrLf:=Format(cCr, 1); // Display line break
                    Clear(osInStream);
                    if "Documents Manquants".HasValue then
                    begin 
                        locCalculLoyerEntete."Documents Manquants".CreateInStream(osInStream);
                        while not osInStream.EOS do begin
                            osInStream.ReadText(sLine);
                            sDocsManquants+=sLine+sCrLf;
                        end;
                    end;
                end;
    

Answers

  • AlexeyShaminAlexeyShamin Member Posts: 80
    Hello!
    try this one:
    CR[1] := 10;
    TempBlob.Blob := "Documents Manquants";
    TempBlob.REadAsTExt(Cr, TEXTCODING::Windows);

    CR - Text(1)
    TEmpBlob - record TempBlob
  • MelekBoujelbeneMelekBoujelbene Member Posts: 17
    Answer ✓
    Hi,

    The solution that I found is using a Text field that I fill with InStream
    trigger OnAfterGetRecord();
                var
                    locCalculLoyerEntete : Record "Calcul Loyer Entete";
                    osInStream : InStream;
                    sLine : Text;
                    sCrLf : Text;
                    cCr : Char;
                begin
                    locCalculLoyerEntete.Get("No.");
                    locCalculLoyerEntete.CalcFields("Documents Manquants");
                    // Transform BLOB "Documents Manquants" to Text in sDocsManquants
                    sDocsManquants:='';
                    sLine:='';
                    cCr:=10;
                    sCrLf:=Format(cCr, 1); // Display line break
                    Clear(osInStream);
                    if "Documents Manquants".HasValue then
                    begin 
                        locCalculLoyerEntete."Documents Manquants".CreateInStream(osInStream);
                        while not osInStream.EOS do begin
                            osInStream.ReadText(sLine);
                            sDocsManquants+=sLine+sCrLf;
                        end;
                    end;
                end;
    

Sign In or Register to comment.