my @tableProp5 = ( widths => [inches(3), inches(4)], #--> width of each column align => 'l l', ); my @myText = ( [\'\fs20\b this', 'that'], [\'\fs20\b this', 'that'], [\'\fs20\b this', 'that'], [\'\fs20\b this', 'that'], ); RTFTable(@tableProp5, 9, 7, @myText); $fh->close(); sub RTFTable{ my (@tableProps, $headerColor, $bgColor, @Text ) = @_; my $count = 0; my $oDecl5; foreach (@Text) { if($headerColor eq undef || $headerColor eq "" || $headerColor == 0 || $count == 0){ $oDecl5 = RTF::Writer::TableRowDecl->new(@tableProps); $oDecl5->add_bgcolors($headerColor); # Adds background color using color hash $fh->row($oDecl5, $_); $count++; }else{ $oDecl5 = RTF::Writer::TableRowDecl->new(@tableProps); $oDecl5->add_bgcolors($bgColor); # Adds background color using color hash $fh->row($oDecl5, $_); } } }