how to change the cell color of confluence table storage format?

Shaurya Chawla December 10, 2018

I am trying to change the color of either the text of table cells or the background color of a cell. I tried this way but when POSTing through REST api to confluence it results in error " parsing xhtml".

I tried below ways in my code:

 tableData += "<td><span style = color:#FF0000;>" + some text + "</span></td>"

In a html editor it does show the text for the cell as red colored but when posted using Confluence cloud restful API it gives 400 bad response error. 

I did explore here but no luck https://confluence.atlassian.com/conf612/confluence-storage-format-958777608.html#ConfluenceStorageFormat-Texteffects

 Any helpful suggestions?

1 answer

1 accepted

1 vote
Answer accepted
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 11, 2018

Hello Shaurya,

As an example, I have created a 3 Column/3 Row table. From that I set highlighted colors and font colors (only the first column has font colors applied. The example below will show you what the storage format for this would look like (this is also what you will use when you make your PUT REST request).

image.png

"<p>Testing page</p><table class=\"wrapped\"><colgroup><col /><col /><col /></colgroup><tbody><tr><th>Header 1</th><th>Header 2</th><th>Header 3</th></tr><tr><td class=\"highlight-grey\" data-highlight-colour=\"grey\"><span style=\"color: rgb(255,255,255);\">Row 1A</span></td><td class=\"highlight-red\" data-highlight-colour=\"red\">Row&nbsp;1B</td><td class=\"highlight-green\" data-highlight-colour=\"green\">Row 1C</td></tr><tr><td class=\"highlight-grey\" data-highlight-colour=\"grey\"><span style=\"color: rgb(255,255,255);\">Row 2A</span></td><td class=\"highlight-red\" data-highlight-colour=\"red\">Row 2B</td><td class=\"highlight-green\" data-highlight-colour=\"green\">Row 2C</td></tr><tr><td class=\"highlight-grey\" data-highlight-colour=\"grey\"><span style=\"color: rgb(255,255,255);\">Row 3A</span></td><td class=\"highlight-red\" data-highlight-colour=\"red\">Row 3B</td><td class=\"highlight-green\" data-highlight-colour=\"green\">Row 3C</td></tr></tbody></table><p class=\"auto-cursor-target\"><br /></p>"

Please note that highlighted colors will be restricted to what available colors are in Confluence. Font color may also apply to this as well. Meaning you may not be able to use hex color to apply colors outside of HTML macros.

Regards,
Stephen Sifers

Richard Houde June 6, 2024

This has been a while for this but I get error 500 when I try to use this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events