how to place HTML table code in confluence page?

Kirti sabade August 22, 2019

I am having issue in displaying HTML table in confluence. Table works fine in browser but not in confluence. is there any specific plugin/macro which needs to enabled? please help me with this. 

1 answer

1 accepted

2 votes
Answer accepted
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2019

You need to do this inside HTML macro, in newer version of confluence this macro needs to be enabled from Admin screen.

Kirti sabade August 22, 2019

Hi,

Thank you for your kind response.

I have code inside HTML macro. Version of confluence is  6.13.4.  Table is displaying in browser but not in confluence. Please help me with the solution..

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2019

Have you sanitized markup for table?

Can you share small snippet of editor from confluence where you are adding table html code.

Kirti sabade August 22, 2019

Capture.PNGOkay, i have this HTML code for table which i directly written in HTML macro of confluence. In browser it's showing proper colored,bordered table but in confluence it's not showing any table, 

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2019

@Kirti sabade

There are few points here,

  • HTML macro is not meant for creating new html page inside existing HTML page of confluence.
  • If want to style table differently, start with <table> tag, and use inline styling for its elements.
  • If you still want to create full <html> then try wrapping it in <iframe>.

Like this for inline styling,

<table>

<tr><th style="color: #FF0000;">Head</th></tr>

<tr><tr style="color: #00FF00;">Row</tr></tr>

</table>

 

And like this for <iframe> wrapping

<iframe>

<!DOCTYPE html>

<html>

<head>

<style>

table th {

color: #FF0000;

}

table tr {

color: #00FF00;

}

</style>

</head>

<body>

<table style="width:100%">

<tr> <th>Head</th> </tr>

<tr> <td>Row</td> </tr>

</table>

</body>

</html>

</iframe>
Kirti sabade August 22, 2019

Okay, I have this 400 line table code. Now please tell me where should i place this entire code if i want this to appear in confluence, exact same as way as it appears in my web browser. 

And thank you so much for bearing with me. much appreciated sir :) 

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2019

I would suggest use inline styling, and start content directly from <table> tag.

Kirti sabade August 22, 2019

C.PNG 

When i paste your sample code in <iframe> this what i get.

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 22, 2019

Better use inline styling. Try that also.

Iframe uses changes in confluence from version to version.

Kirti sabade August 23, 2019

iframe.PNG

SO in inline style, should i paste entire html code or just from <table> tag? if only <table> then where will i paste <html> and <iframe>? what will be in the URL section?

 

Thanks,

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2019

No, you need to use HTML macro only.

And put html code like this in it.

<table>

<tr style="border: 2px solid #333; backgroud-color: #efefef; color: #999;" ></tr>

</table>

Here

style="border: 2px solid #333; backgroud-color: #efefef; color: #999;"

is inline style for table's tr element.

Like Kirti sabade likes this
Kirti sabade August 23, 2019

Its looking like this,

cc.PNG

Table should rather look like this,tt.PNG

Whats the ideal way to implement this,

DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2019

So I have tried is my self, I have added this code to HTML macro

Screenshot 2019-08-23 at 1.43.53 PM.png

 

Which produces this output

Screenshot 2019-08-23 at 1.44.06 PM.png

Like Kirti sabade likes this
Kirti sabade August 23, 2019

How come it's not working with me.. is it because i need to place images and text strings inside the table rows and columns?

 

okay here is my mail-id sabadekirti95@gmail.com please send hi, i will share the code snippet with you. here i could't able to share large code. would you be fine with that? otherwise also its fine.

Kirti sabade August 23, 2019

Here is how my code looks. there are tiny images on every row and column.

a.PNG

Kirti sabade August 23, 2019

Never mind, Guess what?? It worked!! Thank you so much sir! I owe you so much..

 

Thank you so much for your patience and help! great day ahead!

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events