Page 1 of 1
Font is not taken when inserting into RichEdits in HTML format
Posted: Wed Dec 16, 2020 12:19 pm
by tomr
Hello RichView Suport,
we have tested your components [CompiledDemos\ActionTests\ScaleRichView\ActionTestUni.exe] from this link
https://www.trichview.com/rvfiles/TRich ... sSetup.exe. There occured one problem in inserting a html text from a mail. The font in the mail was ARIAL. After inserting the text into the RichEdit via function „Paste Special…“ in HMTL format the font of the text in the RichEdit was „TimesNewRoman“.
- RichView_html_format.jpg (111.18 KiB) Viewed 22039 times
Are you aware of this effect and is it possible to keep the font of the original HMTL text in the RichView?
Best Regards
Nedeljka
Re: Font is not taken when inserting into RichEdits in HTML format
Posted: Wed Dec 16, 2020 2:17 pm
by Sergey Tkachenko
Hello,
The compiled demo uses a basic HTML importer (TrvHtmlImporter component) that supports only basic HTML formatting; it does not support CSS.
There is an alternative HTML importer component producing much better results, TrvHtmlViewImporter.
But it requires additional third-party component, THMLViewer.
It is free with source code. You can download it here:
https://github.com/BerndGabriel/HtmlViewer
After installing its packages (for new versions of Delphi, they are named FrameViewer.dpk (runtime) and dclFrameViewer.dpk (designtime)), recompile TRichView packages (use "Install TRichView in Delphi IDE" shortcut in Windows Start menu).
TrvHtmlViewImporter must be installed.
To use it in RichViewActions, open one of ActionTest projects. Place THTMLViewer on a main form, make it hidden. Place TrvHtmlViewImporter on the same form. Assign RVAControlPanel1.HTMLComponent = rvHtmlViewImporter1, rvHtmlViewImporter.HTMLViewer = HTMLViewer1.
That's all. Now open, insert file, and paste actions use this importer.
Re: Font is not taken when inserting into RichEdits in HTML format
Posted: Fri Mar 04, 2022 10:56 pm
by jgkoehn
Greetings Sergey,
Would you still recommend this HTMLViewer with Delphi 11? We are pasting from HTML into TRichViewEdit but are not getting color. Is this perhaps why? (Even using Paste Special > Html)
Re: Font is not taken when inserting into RichEdits in HTML format
Posted: Sat Mar 05, 2022 7:04 am
by Sergey Tkachenko
Yes, HTML import using THTMLViewer + TrvHtmlViewImporter is still the best option.
Re: Font is not taken when inserting into RichEdits in HTML format
Posted: Thu Jun 30, 2022 9:18 am
by edwinyzh
Any possibility of a "TrvHCLImporter" that integrates with
http://delphihtmlcomponents.com/?
I assume it can produce better import result.
Re: Font is not taken when inserting into RichEdits in HTML format
Posted: Thu Jun 30, 2022 9:23 am
by Sergey Tkachenko
No, I plan to implement native HTML import, without third-party components.
Currently, this is the main priority (not counting FMX-related features)
Re: Font is not taken when inserting into RichEdits in HTML format
Posted: Fri Sep 16, 2022 7:31 pm
by jgkoehn
Will the html importer work with external css? Also will it be a tag style < > importer?
We are using the older version and need to update to accommodate the external css. (We have done a lot of internal modifications to the previous html importer to support some of our needs.)
I added regex support before the import so we can modify portions of the html as we need and so we can add our own specialized tags.
Re: Font is not taken when inserting into RichEdits in HTML format
Posted: Fri Sep 16, 2022 8:15 pm
by Sergey Tkachenko
Yes, native HTML import code will support all types of CSS, internal, external and inline.
It is almost ready but still too buggy to be released.
I'll complete port to Android (soon) and return to HTML import.