Writing html code in WP5

  • I use WPRichText1 in HTML and it works great, but I really would like to know how to embed html code inside one column. The following code, for example,

    'simple text' + <b> + 'bold text' + '</b>'

    gives me the output:

    'simple text<b>boldtext</b>'

    I must be missing something but what?
    These are the settings used:
    WPRichText1.DefaultIOFormat := 'HTML';
    WPRichText1.TextLoadFormat := 'HTML';
    WPRichText1.TextSaveFormat := 'HTML';

    • Offizieller Beitrag

    Hi,

    Inserted HTML code will be treated as text, this means <b> will be converted into &lt;b&gt;. Currently you can only add HTML code if you customize the HTML writer (WPIOHTML.PAS), for example to use a certain TWPTextObj as placeholder for HTML text.

    Code
    if txtobj.Name = 'HTMLCODE' then
            begin
              WriteString(txtobj.Source);
            end else
            if txtobj.Name = 'UNICODEC' then
            .....


    Now you can insert a TWPTextObj, gibve it the name 'HTMLCODE' and add some HTML tags to property 'Source'.

    Julian