Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,555,778
Community Members
 
Community Events
184
Community Groups

How to wrap text & resize cell height when exporting tables to PDF?

I've checked around other answers here and nothing seems to quite be working. I've fiddled with overflow-wrap, white-space, and word-wrap to no avail.

 

Our documents have table cells containing a fair amount of text. When viewing the table in Confluence, the text wraps and a new line begins upon hitting the edge of a cell. When exported to PDF however, no line break is added. The text either overflows into the next cell, or is clipped if it overflows the table.

 

Here is the PDF stylesheet rules I'm currently using:

table {
page-break-inside: auto !important;
width: 100% !important;
table-layout: fixed !important;
}
tr {
page-break-inside: avoid!important;
page-break-after: auto!important;
min-height: 3em;
}
p {
white-space: pre;
}

The width and page-break rules are there because if a table ran over the end of a page it was shrinking the entire table to a minuscule size to fit. The table-layout rule keeps the user adjusted column widths respected.

Examples of the problem:

2019-10-24_13-11-18.png2019-10-24_13-09-50.png

Any help here would be greatly appreciated!

1 answer

0 votes
Herve Frydlender
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 25, 2019

Hi,

This is what I'm using to get "nice" table export in PDF : 

/* Fix default behavior on table's column width */
table
{
table-layout: auto !important;
width: auto !important;
word-wrap: normal;
}

The word-wrap property is the one that changes everything for me.

Hope this helps

Thanks for the reply. I appreciate the help.

Unfortunately that's not doing anything perceivable. I tried using word-wrap (and adding `!important`) which didn't work. I then tried matching all your rules and it just broke the formatting further.

Herve Frydlender
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 31, 2019 • edited

Strange :(

Here is an example of what I get :

Capture.PNG

Yeah on our end it stops respecting the right hand page margin for the entire table and overflows. It still doesn't wrap any text.

2019-10-31_11-33-26.png

It was actually the <p> white-space rule that was screwing it up. Changing it to "pre-wrap" preserves the wrapping of text in tables as well as any intentional white space placed in the document (the latter being why it was there to begin with). Table width definitely needs to be set to 100% or the tables overflow the page however. Table layout set to fixed was required for us to preserve user sizing on the tables (for form templates).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events