It may be terrible but I've like to go though spreadsheets cell by cell and format based on whatever that cell wants, this kinda demonstrates both.
In your code you're always writing to the same column, it's not clear how you get to different columns so I'm guessing at this..my $ssw = Spreadsheet::WriteExcel->new('file.xls'); my $ss = $ssw->add_worksheet($thing); my $ssformat = $ssw->add_format(); my $ssborder = $ssw->add_format(); $ssformat->set_text_wrap(); $ssformat->set_border(); $ss->set_column( 'B:B', 21 ); for ( my $r = 0; $r <= $#ss; $r++ ) { for ( my $c = 0; $c <= $#{ $ss[$r] }; $c++ ) { if ( $c == 4 ) { $ss->write_string( $r, $c, ${ $ss[$r] }[$c], $ssformat ); } else { $ss->write_string( $r, $c, ${ $ss[$r] }[$c], $ssborder ); } } }
for my $stmt (@{$ary_ref}) { my $format = $stmt->{col} == 1 ? $format_a : $format_b; $worksheet->write_col(15,$col,$ary_ref,$format); last; }
In reply to Re: Formatting Excel blocks from query load
by flummoxer
in thread Formatting Excel blocks from query load
by cocl04
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |