WPCubed Product Support

Editor Displays Text Without Extra Line Breaks

Hi,

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

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,

#1 ♥ 0
11k Views 2 users read 5 min

Hi Julian,

I didn't hear back from you after my last reply with version info. I will appreciate if you can provide feedback.

Thanks,

#4 ♥ 0
support

You need to get the latest version (V5.36).

If it does not work please post your example text - or check which control characters are used for tthe line breaks.

Julian

#5 ♥ 0

Hi Julian,

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

'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,

#6 ♥ 0

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,

#7 ♥ 0
support

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)

if FixedHeight = 0 then
        begin
          //if CachedAttr.OutputValues.Height=0 then   //V5.30.4
          // begin
            if par.LoadedCharAttr<>0 then
            begin
               RTFData.RTFProps.Attributes.GetCharAttr(par.LoadedCharAttr, AttrProps);
               PropsToFontValues(AttrProps, InheritededFlags, InputValue.InputValues);
            end else
            if par.AGetInherited(WPAT_CharFontSize, cs) then
            begin
              PropsToFontValues(AttrProps, InheritededFlags, InputValue.InputValues);
              InputValue.InputValues.Size := cs;
              if par.AGetInherited(WPAT_CharFont, cs)  then
                 InputValue.InputValues.Font := cs;
            end else
            PropsToFontValues(RTFData.ANSITextAttr.ca, InheritededFlags, InputValue.InputValues);
            UpdateFontWidthHeight;
          // end;
          par._DefaultHeight := CachedAttr.OutputValues.Height;
          par._DefaultBase := CachedAttr.OutputValues.Base;
        end else
        begin
          par._DefaultHeight := FixedHeight;
          par._DefaultBase := FixedHeight;
        end;
#8 ♥ 0

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,

#9 ♥ 0
support

This code is in unit

procedure TWPRTFEnginePaint.InitializePar.

It comes after the line

if FixedHeight = 0 then

within this procedure.

Julian

#10 ♥ 0

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:

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;
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;
if FixedHeight <= 0 then                begin                  par.CharPos[pos_in_par].Height := CachedAttr.OutputValues.Height;                  par.CharPos[pos_in_par].Base := CachedAttr.OutputValues.Base;                end;
if FixedHeight > 0 then            begin              par.CharPos[pos_in_par].Height := FixedHeight;              par.CharPos[pos_in_par].Base := FixedHeight;            end;
if (par.CharCount = 1) then
            begin
              if FixedHeight = 0 then
              begin
                par._DefaultHeight := CachedAttr.OutputValues.Height;
                par._DefaultBase := CachedAttr.OutputValues.Base;
              end else
              begin
                par._DefaultHeight := FixedHeight;
                par._DefaultBase := FixedHeight;
              end;
            end;

This might give you a clue.

Thanks,

#11 ♥ 0
support

Hi,

You found it:

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

if par.LoadedCharAttr<>0 then 
            begin 
               RTFData.RTFProps.Attributes.GetCharAttr(par.LoadedCharAttr, AttrProps); 
               PropsToFontValues(AttrProps, InheritededFlags, InputValue.InputValues); 
            end else 
            if par.AGetInherited(WPAT_CharFontSize, cs) then 
            begin 
              PropsToFontValues(AttrProps, InheritededFlags, InputValue.InputValues); 
              InputValue.InputValues.Size := cs; 
              if par.AGetInherited(WPAT_CharFont, cs)  then 
                 InputValue.InputValues.Font := cs; 
            end else 
            PropsToFontValues(RTFData.ANSITextAttr.ca, InheritededFlags, InputValue.InputValues); 
            UpdateFontWidthHeight; 

          par._DefaultHeight := CachedAttr.OutputValues.Height; 
          par._DefaultBase := CachedAttr.OutputValues.Base;

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

#12 ♥ 0
This category is archived. No new posts are possible.