Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002817 [JEDI VCL] 00 JVCL Components major always 2005-03-29 09:14 2006-04-05 01:18
Reporter MrT View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.00 BETA 2
Summary 0002817: RichEditToHTML does not translate accurately.
Description Hi:

  In testing I set 5 strings in JvRichEdit, each string in incrasing size for test.
Conversion to HTML results in garbled up strings totally unlike what was displayed in the JvRichEdit.
Additional Information I have attached file from the received email

These are input strings:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs20 This is test line no. 1 10\par
\par
\fs32 This is test line no. 2 16\fs20\par
\par
\fs40 This is test line no. 3 20\fs20\par
\par
\fs48 This is test line no. 4 24\par
\fs20\par
\fs56 This is test line no. 5 28\fs20\par
\par
\fs72 This is test line no. 6 36\par
\fs20\par
}
 
This is output form RichEditToHTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body>
 

<FONT COLOR="#000000" SIZE="4" FACE="MS Sans Serif">

This is test line no. 1 10



<FONT COLOR="#000000" SIZE="2" FACE="MS Sans Serif">This is test line no. 2 </FONT><FONT COLOR="#000000" SIZE="4" FACE="MS Sans Serif">16



</FONT><FONT COLOR="#000000" SIZE="6" FACE="MS Sans Serif">This is test line no. </FONT><FONT COLOR="#000000" SIZE="4" FACE="MS Sans Serif">3 </FONT><FONT COLOR="#000000" SIZE="2" FACE="MS Sans Serif">20



This is test line no.</FONT><FONT COLOR="#000000" SIZE="4" FACE="MS Sans Serif"> </FONT><FONT COLOR="#000000" SIZE="6" FACE="MS Sans Serif">4 24



This is test line </FONT><FONT COLOR="#000000" SIZE="4" FACE="MS Sans Serif">no</FONT><FONT COLOR="#000000" SIZE="6" FACE="MS Sans Serif">. 5 28



This is test line</FONT><FONT COLOR="#000000" SIZE="4" FACE="MS Sans Serif"> no. 6 36
</FONT>

</FONT>
</body>
</html>
 
 
Tags No tags attached.
Attached Files eml file icon 6LinRichEditToHTMLTest.eml [^] (2,561 bytes) 2005-03-29 09:14

- Relationships
related to 0003706resolvedAHUser TJvRichEditToHtml is not formatting properly 

-  Notes
(0006858)
anonymous (viewer)
2005-04-06 17:16

The translation problem was solved by simply changing

      K := K + Length(Value.Lines[I]) + 2;

To

      K := K + Length(Value.Lines[I]) + 1;

I have also added code to identify mail and http links and add the appropriate html code to the email:

      K := K + Length(Value.Lines[I]) + 1; // <-- Insert after

      if Length(St) > 0 then
        begin
          WorkString := St;
          iSS := AnsiPos('@', WorkString);
          if (iSS > 0) and (mailFound = False) then
            begin
              mailFound := True;
              iTemp := iSS;
              while (not (Copy(WorkString, iTemp, 1) = ' ')) and (iTemp >= 0) do
                iTemp := iTemp - 1;
              iStart := iTemp + 1;
              itemp := iSS;
              while (Copy(WorkString, iTemp , 1) <> ' ') do
                iTemp := iTemp + 1;
              iEnd := iTemp;
              workingmailAddress := Copy(workString, iStart, iEnd - iStart);
              mailAddress := cLINKMailBegin + workingmailaddress + cLINKRefEnd +
                             workingmailAddress + cLINKEnd;

              WorkString := Copy(WorkString, 0, iStart - 2) + mailAddress + Copy(WorkString, iEnd + 1, Length(WorkString) - iEnd);
              St := WorkString;
              mailFound := False;
            end;
          WorkString := St;
          iSS := AnsiPos('http://', [^] WorkString);
          if (iSS > 0) and (httpFound = False) then
            begin
              httpFound := True;
              iStart := iSS;
              itemp := iSS;
              while (Copy(WorkString, iTemp , 1) <> ' ') do
                iTemp := iTemp + 1;
              iEnd := iTemp;
              workinghttpAddress := Copy(workString, iStart, iEnd - iStart);
              httpAddress := cLINKHTTPBegin + workinghttpaddress + cLINKRefEnd +
                             workinghttpAddress + cLINKEnd;

              WorkString := Copy(WorkString, 0, iStart - 2) + httpAddress + Copy(WorkString, iEnd + 1, Length(WorkString) - iEnd);
              St := WorkString;
              httpFound := False;
            end;
        end;
(0008752)
obones (administrator)
2006-03-30 06:30

Changing the +2 to +1 is definitely NOT the answer, it does not solve the problem.
There was a bug in AttToHtml in the way it calculates the font size, I've fixed it. However, there is still a bug in the way "wordwrap" lines are handled, I'm still investigating.
(0008753)
obones (administrator)
2006-03-30 06:45

Ok, I found the culprit. The use of K to calculat a new SelStart each time is not working. Incrementing it each time a character is processed, and adding 2 after a line has been read is the way to go.
This will be put in CVS after SourceForge has fixed the issues affecting it.
(0008926)
obones (administrator)
2006-04-05 01:18

This is now in CVS

- Issue History
Date Modified Username Field Change
2005-03-29 09:14 MrT New Issue
2005-03-29 09:14 MrT File Added: 6LinRichEditToHTMLTest.eml
2005-04-06 17:16 anonymous Note Added: 0006858
2006-03-30 06:30 obones Note Added: 0008752
2006-03-30 06:30 obones Status new => confirmed
2006-03-30 06:45 obones Note Added: 0008753
2006-04-05 01:18 obones Status confirmed => resolved
2006-04-05 01:18 obones Resolution open => fixed
2006-04-05 01:18 obones Assigned To => obones
2006-04-05 01:18 obones Note Added: 0008926
2006-05-16 00:52 obones Relationship added related to 0003706


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker