RvHtmlImporter v0.0027 bugs

General TRichView support forum. Please post your questions here
krho
Posts: 33
Joined: Wed Nov 01, 2006 10:17 am

Post by krho »

You also need to install THTML from pbear.com.... You overwrite some files from pbear.com with files in package you downloaded here, and then you compile everything.

Regards,
Miha
wasuplee123
Posts: 12
Joined: Mon May 12, 2008 11:29 pm

Post by wasuplee123 »

Thank you very much Sergey. This is working much better than the older HTML import component.

I agree with nicefive about some concern over so many dependencies, but it is working, and all of these add-ons have source code available, so I'm fine with that.
It would be nice in the future (if you're bored :)) if this didn't require the THTMLViewer component and if the RvHTMLViewImport was just integrated into RvRichEdit, just like the TRichView HTML exporting capabilities are.

Anyways, I am getting close to finishing my evaluation/testing of the TRichView component and it's looking very likely that I will purchase it.

Thanks again for all the help.
wasuplee123
Posts: 12
Joined: Mon May 12, 2008 11:29 pm

Post by wasuplee123 »

I seem to have found an issue w/the new HTML importer. This may also be some issue w/the HTML exporting of TRichView, but I'm pretty sure it's just an issue on the import side.

When I have make a bulleted list and then export to html I get an HTML like this:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title></title>
<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 /* Normal */
{
 font-size: 10pt;
 font-family: 'Arial', 'Helvetica', sans-serif;
 font-style: normal;
 font-weight: normal;
 color: #000000;
 text-decoration: none;
 ;
}
span.rvts1
{
 color: #000000;
}
/* ========== Para Styles ========== */
p,ul,ol /* Left */
{
 text-align: left;
 text-indent: 0px;
 padding: 0px 0px 0px 0px;
 margin: 0px 0px 0px 0px;
}
.rvps1
{
 background: #ffffff;
}
.rvps2
{
 background: #ffffff;
 margin: 0px 0px 0px 20px;
}
--></style>
</head>
<body>

<ul style="text-indent: 0px; margin-left: 24px; list-style-position: outside;">
<li class=rvps1><span class=rvts1>test1</span></li>
<li class=rvps1><span class=rvts1>test2</span></li>
</ul>

</body></html>
Notice that the margin-left on the bullet list is 24px. When I then import the HTML again, and if I go to the bullets and numbering settings, it says the left indent on the list is 49. So then if I export to HTML again, the margin-left becomes 49px. And then if I import again from HTML the left indent shows 74. So when I export a 3rd time to HTML, the margin-left becomes 74px.

Basically, the margin-left continues increasing every time I export, but the issue seems to be that the HTML importer is increasing the left indent.

Thanks in advance for any help.
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, I think this is the problem in the importer.
It will be fixed in the next update. Unfortunately, it will be not sooner than after 2 weeks, because I am going on vacation.
wasuplee123
Posts: 12
Joined: Mon May 12, 2008 11:29 pm

Post by wasuplee123 »

Any updates on this?
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Not yet, I am working to fix this problem.
wasuplee123
Posts: 12
Joined: Mon May 12, 2008 11:29 pm

Post by wasuplee123 »

Is there any estimate for when this will be done?

This is the only issue (that I know of) that's keeping me from purchasing this component and using it in my application.
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry for the delay. Will be implemented in this month.
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Open rvHtmlViewImport.pas, find the lines:

Code: Select all

    ll.MarkerIndent := sec.ContentLeft;
    ll.FirstIndent := 0;
    ll.LeftIndent := sec.ContentLeft+20; //TODO width of marker
and change them too:

Code: Select all

    ll.MarkerIndent := sec.ContentLeft-24;  //TODO width of marker
    if ll.MarkerIndent<0 then
      ll.MarkerIndent := 0;
    ll.FirstIndent := 0;
    ll.LeftIndent := sec.ContentLeft;
wasuplee123
Posts: 12
Joined: Mon May 12, 2008 11:29 pm

Post by wasuplee123 »

Thanks for the reply.

This worked, but only after I made some changes:

Code: Select all

    ll.MarkerIndent := sec.ContentLeft-29;  //TODO width of marker
    if ll.MarkerIndent<0 then
      ll.MarkerIndent := 0;
    ll.FirstIndent := 0;
    ll.LeftIndent := sec.ContentLeft-5;
Notice how I had to subtract the MarkerIndent and LeftIndent by 5.

Anyways, this all seems like a workaround. Shouldn't this shifting by 29 and 5 not be required (I do see it says "TODO width of marker" in the code)?

I will continue with some tests and will let you know if I find any other issues.
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Why do you need these subtractions?
ll.LeftIndent is exactly the same as sec.ContentLeft - a distance from the left margin to the paragraph text.
ll.MarkerIndent is a distance from the left margin to the marker. Since width of marker is unknown, I assumed that it is 24 pixels.

24 is used because this is the default value for list indents in RichViewActions.
wasuplee123
Posts: 12
Joined: Mon May 12, 2008 11:29 pm

Post by wasuplee123 »

If I don't put those subtractions, I get the same issue as before. When I step through that code, sec.ContentLeft is 29, not 24, even though I'm not changing any indent settings. I think I may have found out why this happens.

When I export a TRichView with just a single bullet, I get this HTML:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title></title>
<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 /* Normal */
{
 font-size: 10pt;
 font-family: 'Arial', 'Helvetica', sans-serif;
 font-style: normal;
 font-weight: normal;
 color: #000000;
 text-decoration: none;
 ;
}
/* ========== Para Styles ========== */
p,ul,ol /* Left */
{
 text-align: left;
 text-indent: 0px;
 padding: 0px 0px 0px 0px;
 margin: 0px 0px 0px 0px;
}
--></style>
</head>
<body>

<ul style="text-indent: 0px; margin-left: 24px; list-style-position: outside;">
<li>test</li>
</ul>

</body></html>
Notice how the body has 5 pixel margins. That could account for the 5 pixel difference I'm having. Maybe the code we changed needs to account for the body margins?
Sergey Tkachenko
Site Admin
Posts: 17357
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, you are right, it appears that ContentLeft includes left margin, when the list is inside the main document.
Unfortunately, when in the list is inside cell, left margin is not included there, and I was not able to find a way to distinguish these cases.
So I tried a different approach, using Indent property of TBlock representing <ul>
A new version is uploaded.
Post Reply