CRLF in Textelement

Good Day,

I have a problem with the Text and the Memo element.
My goal is to remove or ignore the CRLF control character. The value of the Textelement is '[frxdsqryData."Name"]'
Unfortunately in this field the Name is stored like this:

'Mr.
John Smith'

So the Textelement only shows 'Mr.'
What I want is 'Mr. John Smith'
I don't want to make the element higher then 1 unit.

Already tested:

Clipped true / false
CR true/false

Any idea? Thanks for your help

Comments

  • edited October 2012
    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    var
    pp : integer;
    str01,
    str02,
    newstr,
    str : string;
    begin
    newstr := '<blank>';
    str := Trim( <ppxAcc."DA_NOTES"> ); // trim just to be safe
    pp := Pos( #13#10, str );
    if pp > 0 then
    begin
    str01 := Copy( str, 1, pp - 1 );
    str02 := Copy( str , pp + 2, 128 ); // crlf is a 2 character pair
    newStr := str01 + ' ' + str02;
    end;
    fldNotes.Text := newstr;
    end;
  • Thanks,

    so its only possible to remove the CRLF by get the position of it and ignore it while copy the data.
    Thanks a lot, I will test it in a few hours and post the result.

    Thanks technisoft
  • edited October 2012
    Okey, in gernal it works. But if there is no CRLF in the String the value will be set to '<blank>'

    so I modified your Code a little bit:
    procedure RemoveCRLFinCustomerName(Sender: TfrxComponent);
    var
     pp : integer; 
     str01,
     str02, 
     str : string; 
    begin 
     str := Trim( <frxdsqryDaten."CustomerName"> ); // trim just to be safe
     pp := Pos( #13#10, str );
     if pp > 0 then
     begin
           str01 := Copy( str, 1, pp - 1 );
           str02 := Copy( str , pp + 2, 128 ); // crlf is a 2 character pair
           str := str01 + ' ' + str02;                             
     end;        
     frmCustomerName.Memo.Text := str; 
    end;
    

    Thanks for your help. And Topic can be closed

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.