|
Posted by Sandman on 11/17/65 11:26
In article <dg3rlb$qfn$1@news.nems.noaa.gov>, Mark <Mark.Fenbers@noaa.gov>
wrote:
> My PHP script builds a table that is too wide to fit on the paper. Two
> of the columns contain strings that are more lengthy than data in the
> other columns.
>
> I can get the table to fit by letting the browser break the lengthy
> strings across two or more lines, thus allowing the column to get
> skinnier. I do this by inserting spaces in various places in the
> string. But this is not a desirable solution as it would mislead the
> user into thinking the string contains spaces when it doesn't.
>
> Is there an invisible character code I can insert into the string that
> tells the browser that it is allowed to line-wrap the string at this
> place, if needed? Popular word processors have a feature like this
> called "soft hyphens" or "soft breaks", etc.
Well, as far as I know, there is no way to tell the browser to linewrap a long
string to a certain width, only when the string is divided into words, but not
a consecutive string of characters.
A solution could be to put the long field on a row of its own, spanning the
width of the other values.
If the field values are:
1. Foo
2. Bar
3. Donkey
4. Monkey
5. VeryLongStringThatMessesUpWidth
And the table looks like this in crappy ASCII art:
+------+------+---------+---------+---------------------------------+
| Foo | Bar | Monkey | Donkey | VeryLongStringThatMessesUpWidth |
+------+------+---------+---------+---------------------------------+
And field 5 is the same for all lines in the report, you could divide it like
this:
<tr>
<td>Foo</td>
<td>Bar</td>
<td>Donkey</td>
<td>Monkey</td>
</tr>
<tr>
<td colspan='4'>VeryLongStringThatMessesUpWidth</td>
</tr>
Which, in crappy ASCII art would look like this:
+------+------+---------+---------+
| Foo | Bar | Monkey | Donkey |
+------+------+---------+---------+
| VeryLongStringThatMessesUpWidth |
+---------------------------------+
Set style="background-color: #CCC" on the first <tr> to make them be dividers
for each long value.
Hope this helped.
--
Sandman[.net]
[Back to original message]
|