The below html is not working. text-align works but not width. Columns have equal widths.
<table>
<tr>
<th style="text-align: center; font-size: large; width: 5%;">
#
</th>
<th style="text-align: center; font-size: large; width: 10%;">
Number
</th>
<th style="text-align: center; font-size: large; width: 40%;">
Title
</th>
<th style="text-align: center; font-size: large; width: 10%;">
FDX
</th>
<th style="text-align: center; font-size: large; width: 10%;">
OFX
</th>
<th style="text-align: center; font-size: large; width: 10%;">
FIRE
</th>
</tr>
...
Hello @Bruce Wilcox ! As I understand, you need to manually set the Table Column width via REST API.
Looking at your lines, I see that everything should be working, CSS/HTML wise. If we take a look at a 3x3 table created in Confluence, here is what the syntax looks like:
Here is the table:
With this in mind, we can apply the desired width to the <col> tag inside the <colgroup> tag. This element should support size in %.
Try to remove the width parameter from the style in your table headers<th> and move it to the <col> inside <colgroup>.
I hope this helps you out, Bruce! Looking forward to your reply.
Thank you very much, Diego.
I changed to the following and it works.
<table>
<colgroup>
<col style="width: 36px;" />
<col style="width: 48px;" />
<col style="width: 480px;" />
<col style="width: 36px;" />
<col style="width: 36px;" />
<col style="width: 36px;" />
</colgroup>
<tr>
I find that (1) %'s do not work and (2) using pixels actually sets proportional not absolute widths.
I also find that xhtml is required. You must close empty tags with />.
Thank you again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great to know that you were able to create the table, @Bruce Wilcox ! Also, thank you very much for sharing those tips here with the community.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Diego I tried nearly the same <colgroup><col> structure as above using px widths, and I don't get the same effect when creating a cloud confluence page via API. All my columns end up the same width. Note: I am creating the table in an expanded section, so if the two are not compatible, that would be good to know.
Is there any sample code you can share where I can create a test page that works as stated in the 'fix' above?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also can't get it to work on cloud
edit: it's working after doing the initial change in the UI and then modifying the xhtml by hand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.