I tried to insert a user macro for a table via html.
<table border="1" width="400"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table>
However, when the width setting is not rendered and the class confluencetable is appended as below.
<table class="confluenceTable"> <tbody><tr> <th class="confluenceTh">Month</th> <th class="confluenceTh">Savings</th> </tr> <tr> <td class="confluenceTd">January</td> <td class="confluenceTd">$100</td> </tr> <tr> <td class="confluenceTd">February</td> <td class="confluenceTd">$80</td> </tr> </tbody></table>
Is there any way to get around this? Thanks in advance.
Community moderators have prevented the ability to post new answers.
Why not add a class to the table or wrap it in a div e.g.
<style> #com-atlassian-confluence table.savings { width: 400px; } </style> <table class="savings"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table>
or
<style> #com-atlassian-confluence .savings table { width:400px; } </style> <div class="savings"> <table> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> </div>
Hi David,
Yes, it works. Thanks :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The suggestion to inject styling provided at https://confluence.atlassian.com/display/CONFKB/HTML+table+in+User+Macro+not+Respecting+Inline+Style may help as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Excellent - I have actually mangled a bit with tables, and Your solution was needed for my box at http://www.mos-eisley.dk/display/it/mos-box
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Huasoon,
could you please explain in more detail what you want to do? I am not sure about what you mean... Does Confluence do some magic transformation of you macro's HTML code?
Regards,
Niels
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Niels,
Thanks for replying. I wanted to render some customized content with a table using a user macro instead of the user having to create the table using the wiki markup. Another reason is also because I wanted to formatted the width of the table which the editor is unable to do so.
The codes I provided on top demonstrates that Confluence rendering engine will ignore the attributes of the <table> tag and transform the output as in the 2nd set of code.
So I am wondering anyone experienced this and how to set the attributes (e.g. width) of the table. I did further testing and found out that the class is not filtered. I guess it is forcing people to use css instead of html to define the attributes of the table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.