Problem with hyperlink conversion with rvhtmlimport HTML2RVF

General TRichView support forum. Please post your questions here
Post Reply
Darken
Posts: 11
Joined: Tue Jul 22, 2014 1:30 pm

Problem with hyperlink conversion with rvhtmlimport HTML2RVF

Post by Darken »

Hello Sergey!

I have proble with conversion HTML to RVF.

In html bellow you can see hypelink with format (italic, bold and set other color, font name). When convert from HTML to RVF hyperlink format is lost... :(

Code: Select all

      RvHtmlImp := TRvHtmlImporter.Create(RVEdit);

      RvHtmlImp.RichView := RVEdit;
      RvHtmlImp.Encoding := rvhtmleANSI;

      RvHtmlImp.BasePath := ExtractFilePath(FileName);
      RvHtmlImp.Options := [rvhtmloAutoHyperlinks];

      try
        SetLength(s, Stream.Size);
        Stream.ReadBuffer(PRVAnsiChar(s)^, Length(s));
      finally
        Stream.Free;
      end;
      RvHtmlImp.LoadHtml(s);
      RvHtmlImp.BasePath := '';

      rve.Modified := true;      
    finally
      RVEdit.Format;
    end;

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>htmlimg</title>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1251">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
body {
  margin: 5px 5px 5px 5px;
  background-color: #ffffff;
}
/* ========== Text Styles ========== */
hr { color: #000000}
body, table, span.rvts0 /* Font Style */
{
 font-size: 12pt;
 font-family: 'Times New Roman', 'Times', serif;
 font-style: normal;
 font-weight: normal;
 color: #000000;
 text-decoration: none;
}
a.rvts1, span.rvts1
{
 color: #0000ff;
 text-decoration: underline;
}
a.rvts2, span.rvts2
{
 font-family: 'Tahoma', 'Geneva', sans-serif;
 color: #0000ff;
 text-decoration: underline;
}
a.rvts3, span.rvts3
{
 font-family: 'Tahoma', 'Geneva', sans-serif;
 color: #4cd2ff;
 text-decoration: underline;
}
a.rvts4, span.rvts4
{
 font-family: 'Tahoma', 'Geneva', sans-serif;
 font-style: italic;
 color: #4cd2ff;
 text-decoration: underline;
}
a.rvts5, span.rvts5
{
 color: #0000ff;
 text-decoration: underline;
}
a.rvts6, span.rvts6
{
 color: #74ff42;
 text-decoration: underline;
}
a.rvts7, span.rvts7
{
 color: #0000ff;
 text-decoration: underline;
}
a.rvts8, span.rvts8
{
 color: #66ff34;
 text-decoration: underline;
}
a.rvts9, span.rvts9
{
 color: #0000ff;
 text-decoration: underline;
}
a.rvts10, span.rvts10
{
 color: #3cff39;
 text-decoration: underline;
}
span.rvts11
{
 color: #d40dc0;
}
a.rvts12, span.rvts12
{
 color: #8000ff;
 text-decoration: underline;
}
span.rvts13
{
 color: #8000ff;
}
a.rvts14, span.rvts14
{
 color: #a2ff4b;
 text-decoration: underline;
}
a.rvts15, span.rvts15
{
 font-style: italic;
 color: #a2ff4b;
 text-decoration: underline;
}
span.rvts16
{
 color: #ff0000;
}
a.rvts17, span.rvts17
{
 color: #0000ff;
 text-decoration: underline;
}
a.rvts18, span.rvts18
{
 color: #804000;
 text-decoration: underline;
}
a.rvts19, span.rvts19
{
 font-weight: bold;
 color: #804000;
 text-decoration: underline;
}
/* ========== Para Styles ========== */
p,ul,ol /* Paragraph Style */
{
 text-align: left;
 text-indent: 0px;
 padding: 0px 0px 0px 0px;
 margin: 0px 0px 0px 0px;
}
--></style>
</head>
<body>
<p><span class=rvts11>sdafksjdkl</span> fjas</p>
<p> sa kdf&nbsp; <a class=rvts15 href="http://www.google.com">jklasdj</a> f;asjd</p>
<p><br></p>
<p>asdf asdf <a class=rvts19 href="http://www.mail.com">asdf</a> asdf asdf asdf</p>
</body></html>



При конвертации из ХТМЛ формата в РВФ теряется форматирование гиперссылок, то есть не зависимо от выбранного цвета/шрифта и т.д. все стает стандартным (синим).

Так же существуют другие проблемы с сохранением форматирование при конвертации. Такие как сложное форматирование, оно просто все улетает.

Или например

1я строка
2я строка

после сохранения в ХТМЛ формат и обратной конвертации в РВФ (из ХТМЛ) будте выглядеть. (то есть появится отступ во второй строке)

1я строка
2я строка


Thank you, Sergey!
Darken
Posts: 11
Joined: Tue Jul 22, 2014 1:30 pm

Post by Darken »

Или например

1я строка
2я строка

после сохранения в ХТМЛ формат и обратной конвертации в РВФ (из ХТМЛ) будте выглядеть. (то есть появится отступ во второй строке)

1я строка
__2я строка <- во второй строке отступ возникает (выше пробелы не сохранились)
Sergey Tkachenko
Site Admin
Posts: 17267
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TrvHtmlImporter does not support CSS. There are some limited support of CSS saved by TRichView itself, but it does not include hyperlinks, sorry.

The solution is using TrvHtmlViewImporter.

TrvHtmlImporter will not be improved, sorry. We plan to implement TRichView.LoadHtml from scratch, not based on existing importers.
Post Reply