Excel-Template-Element-Cell-AutoSize
view release on metacpan or search on metacpan
lib/Excel/Template/Element/Cell/AutoSize.pm view on Meta::CPAN
#print $font_name . "," . $context->active_format->{'_bold'} . "\n";
if ($cell_width > $context->active_worksheet->{$max_width_key}){
$context->active_worksheet->{$max_width_key} = $cell_width;
$context->active_worksheet->set_column($context->get($self, 'COL'), $context->get($self, 'COL'), $cell_width);
}
$context->active_worksheet->write(
(map { $context->get($self, $_) } qw(ROW COL)),
$self->get_text($context),
$context->active_format,
);
return 1;
}
1;
__END__
=head1 NAME
Excel::Template::Element::Cell::AutoSize
=head1 PURPOSE
To provide a cell that is correctly sized for inserted text
=head1 NODE NAME
CELLAUTOSIZE
=head1 INHERITANCE
Excel::Template::Element::Cell
=head1 CHILDREN
Excel::Template::Element::Formula
=head1 EFFECTS
This will consume one column on the current row.
=head1 DEPENDENCIES
Font::TTFMetrics
=head1 USAGE
<cellautosize text="Some Text Here"/>
<cellautosize>Some other text here</cellautosize>
<cellautosize text="$Param2"/>
<cellautosize>Some <var name="Param"> text here</cellautosize>
In the above example, four cells are written out. The first two have text hard-
coded. The second two have variables. The third and fourth items have another
thing that should be noted. If you have text where you want a variable in the
middle, you have to use the latter form. Variables within parameters are the
entire parameter's value.
Please see Spreadsheet::WriteExcel for what constitutes a legal formula.
=head1 AUTHOR
Tim Howell (tim@fefcful.org)
Based on Excel::Template::Element::Cell by Rob Kinyon
=head1 SEE ALSO
CELL, ROW, VAR, FORMULA
=cut
( run in 0.834 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )