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>

$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 New> which will be parses as HTML source text.

you can then 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,


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>
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 :?: