Update and format table in Confluence using REST API without html macro

24 Views Asked by At

I am able to update a Confluence page via REST API, but the html I send appears to get stripped so that only the data from the table appears on my confluence page. I do not the have html macro enabled on my instance and do not have permission to enable.

In my python, the table comes from a data frame. I use df.to_html to convert to html, then I modify the html to include the background color that I want for the specific data points before sending it to Confluence. Note: I have stripped down the formatting to be very simple, basically only adding

style="background-color: yellow"

to three cells in the table.

Since I save the html in an output file before sending it to confluence, I can verify that my resulting HTML works. The resultant HTML shows the correct table with the correct formatting. However, when I view source in Confluence, the HTML for the table is missing the style code for the specific cells that I modified. It appears as if Confluence is stripping off the style.

Since everything works in the saved output HTML file and only the format is missing in confluence, can someone point me to a best practice, example, or instructions on how to send formatted HTML to confluence? I have tried both formatting style and modifying column widths (tried this, but it did not work either).

Anyone here have success in doing table formatting in Confluence via API?

As mentioned above, I have tried multiple complexities of HTML formatting, eventually attempting only the simplest background color of a few cells and adjusting column width. Again, the HTML for those attempts render properly as an HTML file, and the same HTML is sent via API to Confluence where it appears stripped on the published page.

0

There are 0 best solutions below