rvHtmlImporter style indent

General TRichView support forum. Please post your questions here
Post Reply
jgkoehn
Posts: 294
Joined: Thu Feb 20, 2020 9:32 pm

rvHtmlImporter style indent

Post by jgkoehn »

Greetings
Is the following tag supported in the rvHtmlImporter?

Code: Select all

<p style="text-indent: 40px">This text is indented.</p>
Mainly this portion

Code: Select all

style="text-indent: 40px"
If not, or in another way is there a better place to look for more info on rvHtmlImporter?
Sergey Tkachenko
Site Admin
Posts: 17267
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: rvHtmlImporter style indent

Post by Sergey Tkachenko »

TrvHtmlImporter does not support CSS in HTML (except for a very limited set of CSS attributes).
For HTML containing CSS formatting, use TrvHtmlViewImporter instead. However, it is available only for VCL version of TRichView.
TrvHtmlViewImporter requires a free third-party component THTMLViewer https://github.com/BerndGabriel/HtmlViewer.

Plans for future:
I do not plan to improve THtmlImporter. Instead, I plan to implement TRichView.LoadHtml method from scratch. I plan to implement it in this year, but I cannot guarantee it.
jgkoehn
Posts: 294
Joined: Thu Feb 20, 2020 9:32 pm

Re: rvHtmlImporter style indent

Post by jgkoehn »

Greetings Sergey,
Ah thank you so much for the information.
I understand there is so much in html to look into and a native would be better.
I personally have gone and duplicated HtmlImporter and modified it a lot to support our needs for special import. (It also has a regex engine so we can change tags on the fly before hand.)
Thank you again for your excellent help. I'll look into the other code. Thanks again.
jgkoehn
Posts: 294
Joined: Thu Feb 20, 2020 9:32 pm

Re: rvHtmlImporter style indent

Post by jgkoehn »

Greetings Sergey,
I added a bit to rvHtmlViewImport (I think you said though it will no longer be supported, correct?)
If it is easy to add perhaps update this:

Code: Select all

{------------------------------------------------------------------------------}
function TRVHTMLViewImporter.AppendFromFile(const FileName: TRVUnicodeString;
  RV: TCustomRichView): Boolean;
begin
  Result := HTMLViewer <> nil;
  if not Result then
    exit;
  try
    HTMLViewer.LoadFromFile(FileName);
    AppendHtmlViewer(HTMLViewer, RV, ExtractFilePath(FileName));
  except
    Result := False;
  end;
end;
This makes it possible to Append or could change it to fix Insert well sort of. Just a quick idea.
Sergey Tkachenko
Site Admin
Posts: 17267
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: rvHtmlImporter style indent

Post by Sergey Tkachenko »

Ok, I'll add this method in the next update.
Post Reply