Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Nested tables with RTF::Writer

Reply
Thread Tools

Nested tables with RTF::Writer

 
 
Mahesh A
Guest
Posts: n/a
 
      12-18-2003
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;
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get database metadata information (i.e. existing tables and columns in tables) Chris Brat Python 5 08-22-2006 05:25 PM
Tables within tables Otuatail HTML 7 08-02-2004 04:42 AM
Nested Tables and User Controls Benign Vanilla ASP .Net 1 06-24-2004 02:19 PM
need XML help with nested tables Steve Klett ASP .Net 4 12-09-2003 08:25 PM
Text after 2 tables actually appears between 2 tables ! Peter Bassett HTML 3 08-15-2003 06:46 PM



Advertisments