HtmlViewer(FrameViewer)

Initially it was called THtmlPort, but in the last versions I find it with the name of HtmlViewer. Whatever the correct name today, it is a suite of components (THtmlViewer, TFrameViewer and TFrameBrowser) that allow us to display HTML formatted text.

It's not a web browser but a panel capable of displaying pure HTML code with hyperlink and all, that HTML code can come from instructions in code form or from external files like an index.html saved on disk. Its panel is well behaved and its borders and scrollbars can be hidden, it can be small to the point of being confused with a TLabel which opens up a series of possibilities, since a conventional TLabel doesn't allow HTML tags, but it can also get bigger looking like if with a TMemo/TRichedit, but without the editing feature, after all this component only displays HTML code, but does not allow editing them.

See this simple example of how to use it:

var sHtml_Code:String begin sHtml_Code:=&#039;<h3>Additional information</h3>&#039;; sHtml_Code:=sHtml_Code+&#039;<p>Order #9999 was <strong>called off</strong></p>&#039;; // my preferred way // Note: HtmlViewer1 is the HtmlViewer1.Clear component; HtmlViewer1.LoadFromString(sHtml_Code); // another form that is also accepted: //HtmlViewer1.Text:=sHtml_Code; end;

I consider it essential in my applications. You can also use it in Delphi in the commercial version and Community Edition.

Read the documentation at the links below to learn how to use it.

More information at:
https://wiki.lazarus.freepascal.org/THtmlPort
https://github.com/digao-dalpiaz/DzHTMLText

If you are looking for more examples, please read this other article titled “learning by example“, in it you will find many examples.