diff --git a/lib/Excel/Writer/XLSX/Package/Styles.pm b/lib/Excel/Writer/XLSX/Package/Styles.pm index ae0b3592..6b588a29 100644 --- a/lib/Excel/Writer/XLSX/Package/Styles.pm +++ b/lib/Excel/Writer/XLSX/Package/Styles.pm @@ -794,7 +794,7 @@ sub _write_sub_border { $self->xml_start_tag( $type, @attributes ); - if ( $color && $color != 64 ) { + if ( $color && $color ne "64" ) { $color = $self->_get_palette_color( $color ); $self->xml_empty_tag( 'color', 'rgb' => $color ); diff --git a/t/regression/format25.t b/t/regression/format25.t new file mode 100644 index 00000000..2175e196 --- /dev/null +++ b/t/regression/format25.t @@ -0,0 +1,71 @@ +############################################################################### +# +# Tests the output of Excel::Writer::XLSX against Excel generated files. +# +# Copyright 2000-2024, John McNamara, jmcnamara@cpan.org +# +# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later +# + +use lib 't/lib'; +use TestFunctions qw(_compare_xlsx_files _is_deep_diff); +use strict; +use warnings; + +use Test::More tests => 1; + +############################################################################### +# +# Tests setup. +# +my $filename = 'format25.xlsx'; +my $dir = 't/regression/'; +my $got_filename = $dir . "ewx_$filename"; +my $exp_filename = $dir . 'xlsx_files/' . $filename; + +my $ignore_members = []; +my $ignore_elements = {}; + + +############################################################################### +# +# Test the creation of a simple Excel::Writer::XLSX file with automatic color. +# +use Excel::Writer::XLSX; + +my $workbook = Excel::Writer::XLSX->new( $got_filename ); +my $worksheet = $workbook->add_worksheet(); + +my $format1 = $workbook->add_format( + border_color => '#FF9966', + border => 1, +); + +$worksheet->write( 2, 2, '', $format1 ); + +$workbook->close(); + + +############################################################################### +# +# Compare the generated and existing Excel files. +# + +my ( $got, $expected, $caption ) = _compare_xlsx_files( + + $got_filename, + $exp_filename, + $ignore_members, + $ignore_elements, +); + +_is_deep_diff( $got, $expected, $caption ); + + +############################################################################### +# +# Cleanup. +# +unlink $got_filename; + +__END__ diff --git a/t/regression/xlsx_files/format25.xlsx b/t/regression/xlsx_files/format25.xlsx new file mode 100644 index 00000000..1f1238d9 Binary files /dev/null and b/t/regression/xlsx_files/format25.xlsx differ