M
Mahesh A
Hi,
I am trying to use RTF::Writer to create an RTF document that contains
nested tables (or table with nested cells).
Followng is what i've come up with. Nested $rtf->table() call looks
pretty wrong - table() doesnot return a string. The inner table() call
executes first and I end up getting get two separate tables instead of
nested tables as intended.
Help/guidance from someone with experience in this area would be greatly
appriciated.
Thanks,
Mahesh.
------------------------------------
#!/usr/local/bin/perl -w
# Intent:
# ,-----------------.------------------------------------,
# | Cell1:1 | Cell1:2 |
# |-----------------+------------------.-----------------|
# | Cell2:1 | Cell2:2:1:1 | Cell2:2:1:2 |
# | |------------------+-----------------|
# | | Cell2:2:2:1 | Cell2:2:2:2 |
# `-----------------'------------------'-----------------'
use strict;
use RTF::Writer;
my $rtf = RTF::Writer->new_to_file("table.rtf");
$rtf->prolog( 'title' => "Nested Tables" );
my $parentRow = RTF::Writer::TableRowDecl->new(
'widths' => [3000, 4000]);
my $childRow = RTF::Writer::TableRowDecl->new(
'widths' => [2000, 2000]);
$rtf->table($parentRow,
["Cell1:1", "Cell1:2"],
["Cell2:1", $rtf->table($childRow,
["Cell2:2:1:1", [\'\i', 'Cell2:2:1:2']],
["Cell2:2:2:1", [\'\i', 'Cell2:2:2:2']])]);
$rtf->close;
I am trying to use RTF::Writer to create an RTF document that contains
nested tables (or table with nested cells).
Followng is what i've come up with. Nested $rtf->table() call looks
pretty wrong - table() doesnot return a string. The inner table() call
executes first and I end up getting get two separate tables instead of
nested tables as intended.
Help/guidance from someone with experience in this area would be greatly
appriciated.
Thanks,
Mahesh.
------------------------------------
#!/usr/local/bin/perl -w
# Intent:
# ,-----------------.------------------------------------,
# | Cell1:1 | Cell1:2 |
# |-----------------+------------------.-----------------|
# | Cell2:1 | Cell2:2:1:1 | Cell2:2:1:2 |
# | |------------------+-----------------|
# | | Cell2:2:2:1 | Cell2:2:2:2 |
# `-----------------'------------------'-----------------'
use strict;
use RTF::Writer;
my $rtf = RTF::Writer->new_to_file("table.rtf");
$rtf->prolog( 'title' => "Nested Tables" );
my $parentRow = RTF::Writer::TableRowDecl->new(
'widths' => [3000, 4000]);
my $childRow = RTF::Writer::TableRowDecl->new(
'widths' => [2000, 2000]);
$rtf->table($parentRow,
["Cell1:1", "Cell1:2"],
["Cell2:1", $rtf->table($childRow,
["Cell2:2:1:1", [\'\i', 'Cell2:2:1:2']],
["Cell2:2:2:1", [\'\i', 'Cell2:2:2:2']])]);
$rtf->close;