Editor Displays Text Without Extra Line Breaks

  • Hi,

    We have a code similar to following for loading ANSI text into the editor:

    Code
    Editor.TextLoadFormat := 'ANSI';
    Editor.AsString := aString;

    Before we upgraded to WPTools version 5.30.1, everything worked fine. However, after the upgrade the editor stripped all the extra line breaks (any line breaks after the first) and displayed text without any empty lines.

    How can we fix this behavior?

    Thanks,

  • Hi Julian,

    The following is a sample string content that we experienced the problem with:

    Code
    'Dear Robert Henson:'#$D#$A#$D#$A'You have successfully updated your profile form for our online employment system.  '#$D#$A#$D#$A'Thank you for your interest in employment with our agency. We are looking forward to receiving your applications.'#$D#$A#$D#$A#$D#$A'Sincerely,'#$D#$A'Human Resources'#$D#$A#$D#$A#$D#$A'**PLEASE NOTE: DO NOT REPLY TO THIS EMAIL!  IT IS AUTOMATICALLY GENERATED.**'

    We don't anticipate to upgrade WPTools at this point. Is there a way to fix it in our version (5.30.1).

    Thanks,

  • Hi Julian,

    I am checking back. This issue is very important for us, but we can not upgrade WPTools at this point (probably later). It is just a big undertaking for us because we need to test everything again. Can you give us clues about how to fix it without an upgrade at this point?

    Thanks,

    • Offizieller Beitrag

    Hi,

    I am not exactly certain what this is. I assume the lines are there but not visible.

    locate in unit WPRTEPaint.PASthe following code and comment it out as shown. (Note, this is for V5.30)

  • Julian,

    I couldn't locate the code you mentioned in unit WPRTEPAINT.PAS. I noticed a comment in your code which says V5.30.4, but we have V5.30.1. I think you looked at a different version.

    Thanks,

  • Julian,

    I found that procedure, but still couldn't locate the code you mentioned. I am providing below the code snippets from that procedure which has FixedHeight in the condition of if-then blocks:

    Code
    if (pos_in_par = 0) and (InputValue.InputValues.IsSuperOrSub) and (FixedHeight <= 0) then          begin            InputValue.InputValues.IsSuperOrSub := FALSE;            UpdateFontWidthHeight;            par._DefaultHeight := CachedAttr.OutputValues.Height;            par._DefaultBase := CachedAttr.OutputValues.Base;            InputValue.InputValues.IsSuperOrSub := TRUE;          end;
    Code
    if FixedHeight <= 0 then       begin          if par._DefaultHeight <= 0 then          begin            par._DefaultHeight := CachedAttr.OutputValues.Height;            par._DefaultBase := CachedAttr.OutputValues.Base;          end;       end else       begin          par._DefaultHeight := FixedHeight;          par._DefaultBase := FixedHeight;       end;
    Code
    if FixedHeight <= 0 then                begin                  par.CharPos[pos_in_par].Height := CachedAttr.OutputValues.Height;                  par.CharPos[pos_in_par].Base := CachedAttr.OutputValues.Base;                end;
    Code
    if FixedHeight > 0 then            begin              par.CharPos[pos_in_par].Height := FixedHeight;              par.CharPos[pos_in_par].Base := FixedHeight;            end;

    This might give you a clue.

    Thanks,

    • Offizieller Beitrag

    Hi,

    You found it:

    Code
    if FixedHeight <= 0 then        begin           if par._DefaultHeight <= 0 then           begin             par._DefaultHeight := CachedAttr.OutputValues.Height;             par._DefaultBase := CachedAttr.OutputValues.Base;           end;        end else        begin           par._DefaultHeight := FixedHeight;           par._DefaultBase := FixedHeight;        end;

    The first part must read

    Even if you don't want to upgrade now, I would still recommand to download the current version and extract it to a different directory. You could so play with it under a different installation of Delphi. You would see the current code, the history.txt and this will help you a lot with questions like this.

    Julian