Styled-text in a table cell of 4d write pro

Does anyone know how I can insert text into a cell of a 4D Write pro table using the programming language?
I tried to create a table and add rows using “WP Table append row” with styled-text variable. 4d write shows in the cell text and style-tags as this
2 Comodino,

I do have the same requirement.
Does no answer mean that this is not possible (yet)?

To insert text in a 4D Write Pro table cell, do the following:

<code 4D>
C_OBJECT($cell_o)
C_OBJECT($range_o)
C_OBJECT($wp_o)
C_OBJECT($table_o)

$wp_o:=OBJECT Get pointer(Object named;“writeProArea”)->

$range_o:=WP Create range($wp_o;wk start text;wk end text)
$table_o:=WP Insert table($range_o;wk append;wk exclude from range;3;2)

// get reference to table cell
$cell_o:=WP Table get cells($table_o;2;1;1;1) // reference for column 2, row 1

// translate reference into a range
$range_o:=WP Create range($cell_o;wk start text;wk end text)
</code 4D>

To make the cell’s text red, set the cell’s text color attribute to red:

<code 4D>
// make the cell’s text color red
WP SET ATTRIBUTES($cell_o;wk text color;"#FF0000")

</code 4D>

Here’s the script’s result:

you can also pass a 4D styled-text to https://doc.4d.com/4Dv17/4D/17/WP-New.301-3726295.en.htmlWP New> which will be parses as HTML source text.

you can then https://doc.4d.com/4Dv17/4D/17/WP-INSERT-DOCUMENT.301-3726298.en.htmlWP INSERT DOCUMENT>

Problem is, i already have styled text. Converting this text to plain text an reformatting it with WP Attributes would be quite cumbersome.

But thanks for the answer!

That is really working!
I would never have got the idea to create and insert a new document in a cell just to insert styled text.

Thanks a lot,

Peter

How do you know your text is styled or not :?: Actually WP New work with a styled text but what if I have a simple text :?:

How can I convert a variable TEXT to a styled text variable ? :frowning:

It works with this, but :doubt:

<code 4D>
C_TEXTE($content)
$content:=[LgDevis]Designation
Au cas ou
: ($content=ST Lire texte brut($content))
ST FIXER TEXTE([LgDevis]Designation;$content)
ST fixer ATTRIBUTS($content;ST Début texte;ST Fin texte;Attribut nom de police;“Arial”)
fin de cas

</code 4D>

Why WP New($content) don’t directly work with $content a variable of type text (not styled text) directly :?: