Ignore:
Timestamp:
Jan 29, 2010, 1:37:37 PM (15 years ago)
Author:
Kevin Toppenberg
Message:

Fixed HTML Template line feed issue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/branches/tmg-cprs/CPRS-Chart/Templates/uTemplateFields.pas

    r654 r694  
    55
    66uses
    7   Forms, SysUtils, Classes, Dialogs, StdCtrls, ExtCtrls, Controls, Contnrs,
     7  Forms, SysUtils, StrUtils, Classes, Dialogs, StdCtrls, ExtCtrls, Controls, Contnrs,
    88  Graphics, ORClasses, ComCtrls, ORDtTm;
    99
     
    454454end;
    455455
    456 procedure WordWrapText(var Txt: string);
     456procedure WordWrapText(var Txt: string; HTMLMode : boolean);
    457457var
    458458  TmpSL: TStringList;
    459459  i: integer;
    460460
    461   function WrappedText(const Str: string): string;
     461  function WrappedText(const Str: string; boolHTMLMode : boolean): string;
    462462  var
    463     i, i2, j, k: integer;
    464     Temp: string;
     463    i, i2, j, k, m: integer;
     464    HTMLStrLen : integer;
     465    Temp, Temp1, Temp2: string;
    465466
    466467  begin
     
    508509
    509510    Result := Result + Temp;
    510     Result := WrapText(Result, #13#10, [' '], MAX_ENTRY_WIDTH);
     511
     512    //Count the HTML tag length and add to MAX_ENTRY WIDTH   elh 1-29-10
     513    HTMLStrLen := 0;
     514    if boolHTMLMode = True then begin
     515      temp1 := Result;
     516      while (pos('<',temp1)>0) and (pos('>',temp1)>0) do
     517      begin
     518         temp2 := MidStr(temp1,pos('<',temp1),pos('>',temp1)-pos('<',temp1)+1);
     519         HTMLStrLen := HTMLStrLen + strlen(PChar(temp2));
     520         temp1 := Rightstr(temp1,strlen(PChar(temp1))-pos('>',temp1));
     521      end;
     522    end;
     523
     524    Result := WrapText(Result, #13#10, [' '], MAX_ENTRY_WIDTH+HTMLStrLen);  //added +HTMLStrLen  elh 1-29-10
    511525    repeat
    512526      i := pos(#1, Result);
     
    527541        if Txt <> '' then
    528542          Txt := Txt + CRLF;
    529         Txt := Txt + WrappedText(TmpSL[i]);
     543        Txt := Txt + WrappedText(TmpSL[i],HTMLMode);
    530544      end;
    531545    finally
     
    635649  until(i = 0);
    636650  if not AutoWrap then
    637     WordWrapText(Result);
     651    WordWrapText(Result,HTMLMode);
    638652
    639653end;
Note: See TracChangeset for help on using the changeset viewer.