Table with Fixed Widths

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
hfroemel
Jr. Propeller Head
Posts: 6
Joined: Mon Feb 03, 2014 9:57 am

Table with Fixed Widths

Post by hfroemel »

Hello,

I am trying to create a four column table with fixed widths. The widths are 27%, 27%, 27%, 19%. The output is pdf.

In this table there is unbroken text that exceeds many of the column widths. For example, 27% will only hold "thismuchtext" however the cell contains "alotmoretextthanthattinyexample". Instead of dropping to the next row, the long text is causing my table to completely ignore the fixed column widths.

Here is an example of my code:

Code: Select all

<table style="mc-table-style: url('../Resources/TableStyles/BasicTable.css');width: 100%;margin-left: 0;margin-right: auto;" class="TableStyle_BasicTable" cellspacing="0">
            <col style="width: 27%;" />
            <col style="width: 27%" />
            <col style="width: 27%" />
            <col style="width: 19%;" />
            <thead>
Here is an example of the output
Image

Any help would be greatly appreciated!
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Table with Fixed Widths

Post by LTinker68 »

Fixed column widths won't do a thing if you have unbroken text and if you have hyphenation turned off in your styles. If you have hyphenation enabled, then it might be able to break the content in the right place. However, if you don't have it enabled, or if it can't figure out where to insert a hyphen, then it will always try to keep the content unbroken. I believe this would occur even if you used hard values, like 100px, instead of relative values. In that case, you might have to insert a hyphen yourself. If you do, and you're trying to single-source your project, then you could apply a condition tag to the hyphen so that it's only used in print output but not online output, where you typically have more real estate. I've had to do that a few times, or in cases where I wanted to force a line to break at a specific point and not where Flare would naturally break the line.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
hfroemel
Jr. Propeller Head
Posts: 6
Joined: Mon Feb 03, 2014 9:57 am

Re: Table with Fixed Widths

Post by hfroemel »

Thank you very much for your response LTinker68!

I would not have thought of applying a condition tag to the hyphen. That sounds like a perfect solution. I'll be sure to post a follow up after I try this out. :)
hfroemel
Jr. Propeller Head
Posts: 6
Joined: Mon Feb 03, 2014 9:57 am

Re: Table with Fixed Widths

Post by hfroemel »

Sadly conditioning the hyphen didn't work.

Here's my work around:
  • Copy the long title text and duplicate it in the column header.
    Condition the first title for print.
    Condition the second title for web.
    Add a soft return to the first (print) version of the title.
This is a pain but I could not think of a better solution.
Paul Griffiths
Sr. Propeller Head
Posts: 262
Joined: Wed Apr 18, 2007 2:25 am
Location: Nottingham, UK

Re: Table with Fixed Widths

Post by Paul Griffiths »

This may not help as I am generating CHM not PDF, but I had a similar problem and found using this CSS fixed it:

table td {word-wrap: break-word;}

YMMV
Post Reply