From: Robert Bohne Date: Sun, 29 Apr 2012 15:07:20 +0000 (+0200) Subject: Add formatting tweak to ensure merged formats distinct. #68308 X-Git-Tag: v0.34~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cbac675a7fff112f61fb52225cf2affaa266278c;p=p5sagit%2FExcel-Template.git Add formatting tweak to ensure merged formats distinct. #68308 --- diff --git a/Changes b/Changes index 99b4ec3..d407bff 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl distribution Excel::Template + Merge range formatting tends to collide with non-merged formatting, + thanks to Nigel Metheringham. Fixed some documentation errors, thanks to Robert James Clay. Made Spreadsheet::WriteExcel links in format docs more generic (Nigel Metheringham) Added missing cell comment documentation diff --git a/lib/Excel/Template/Element/MergeRange.pm b/lib/Excel/Template/Element/MergeRange.pm index ed221f3..e8b72dd 100644 --- a/lib/Excel/Template/Element/MergeRange.pm +++ b/lib/Excel/Template/Element/MergeRange.pm @@ -36,6 +36,9 @@ sub render { $values{$k} = $context->resolve( $self, $k ); } + # force is_merged on here to differentiate the formats + $values{is_merged} = 1; + my $format = $context->format_object->copy( $context, $old_format, %values, ); diff --git a/lib/Excel/Template/Format.pm b/lib/Excel/Template/Format.pm index b4cb56c..8918337 100644 --- a/lib/Excel/Template/Format.pm +++ b/lib/Excel/Template/Format.pm @@ -56,6 +56,9 @@ sub _retrieve_key { $_[0]{ $_[1] } } my %params = @_; $params{lc $_} = delete $params{$_} for keys %params; + # force fake slots to be zero if not set + $params{$_} ||= 0 for @_fake_slots; + my @parts = ( (map { $params{$_} ? 1 : '' } @_boolean_formats), (map { $params{$_} ? $params{$_} + 0 : '' } @_integer_formats),