Subject: | Text wrapping kills text |
With the following code I'm setting a FIXED width for all columns.
The code that inserts wrapping newlines "breaks text" both in the second
and third row (killing off text):
#!perl
use Text::ASCIITable;
$t = Text::ASCIITable->new({ headingText => 'Basket' });
$t->setCols('Id','Name','Price');
$t->setColWidth('Name',10,1); #width 10, strict
$t->setColWidth('Id',10,1); #width 10, strict
$t->setColWidth('Price',10,1); #width 10, strict
$t->addRow(1,'Dummy product 1',24.4);
$t->addRow(2,'Dummy product description number 2',21.2);
$t->addRow(3,'Supercalifragilisticepiralidous',12.3);
$t->addRowLine();
$t->addRow('','Total',57.9);
print $t;
__END__
Gives:
.--------------------------------------.
| Basket |
+------------+------------+------------+
| Id | Name | Price |
+------------+------------+------------+
| 1 | Dummy | 24.4 |
| | product 1 | |
| 2 | Dummy | 21.2 |
| | product | |
| | descriptio | |
| | number 2 | |
| 3 | Supercalif | 12.3 |
+------------+------------+------------+
| | Total | 57.9 |
'------------+------------+------------'
Expected?
.--------------------------------------.
| Basket |
+------------+------------+------------+
| Id | Name | Price |
+------------+------------+------------+
| 1 | Dummy | 24.4 |
| | product 1 | |
| 2 | Dummy | 21.2 |
| | product | |
| | descripti- | |
| | on number | |
| | 2 | |
| 3 | Supercali- | 12.3 |
| | fragilist- | |
| | icexpiral- | |
| | idous | |
+------------+------------+------------+
| | Total | 57.9 |
'------------+------------+------------'