-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
worksheet: fix repeat_row() issue with quoted sheet names
Add a fix for an issue where a worksheet name needed quoting when used with a repeat_row()/Print_Titles defined name.
- Loading branch information
Showing
10 changed files
with
629 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
############################################################################### | ||
# | ||
# Tests the output of Excel::Writer::XLSX against Excel generated files. | ||
# | ||
# Copyright 2000-2024, John McNamara, [email protected] | ||
# | ||
# 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 = 'quote_name08.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. | ||
# | ||
use Excel::Writer::XLSX; | ||
|
||
my $workbook = Excel::Writer::XLSX->new( $got_filename ); | ||
my $worksheet = $workbook->add_worksheet('1Sheet'); | ||
my $chart = $workbook->add_chart( type => 'column', embedded => 1 ); | ||
|
||
# For testing, copy the randomly generated axis ids in the target xlsx file. | ||
$chart->{_axis_ids} = [ 55487104, 84573184 ]; | ||
|
||
my $data = [ | ||
[ 1, 2, 3, 4, 5 ], | ||
[ 2, 4, 6, 8, 10 ], | ||
[ 3, 6, 9, 12, 15 ], | ||
|
||
]; | ||
|
||
$worksheet->write( 'A1', $data ); | ||
$worksheet->repeat_rows( 0, 1 ); | ||
$worksheet->set_portrait(); | ||
$worksheet->{_vertical_dpi} = 200; | ||
|
||
$chart->add_series( values => [ '1Sheet', 0, 4, 0, 0 ] ); | ||
$chart->add_series( values => [ '1Sheet', 0, 4, 1, 1 ] ); | ||
$chart->add_series( values => [ '1Sheet', 0, 4, 2, 2 ] ); | ||
|
||
$worksheet->insert_chart( 'E9', $chart ); | ||
|
||
$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__ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
############################################################################### | ||
# | ||
# Tests the output of Excel::Writer::XLSX against Excel generated files. | ||
# | ||
# Copyright 2000-2024, John McNamara, [email protected] | ||
# | ||
# 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 = 'quote_name09.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. | ||
# | ||
use Excel::Writer::XLSX; | ||
|
||
my $workbook = Excel::Writer::XLSX->new( $got_filename ); | ||
my $worksheet = $workbook->add_worksheet('Sheet_1'); | ||
my $chart = $workbook->add_chart( type => 'column', embedded => 1 ); | ||
|
||
# For testing, copy the randomly generated axis ids in the target xlsx file. | ||
$chart->{_axis_ids} = [ 54437760, 59195776 ]; | ||
|
||
my $data = [ | ||
[ 1, 2, 3, 4, 5 ], | ||
[ 2, 4, 6, 8, 10 ], | ||
[ 3, 6, 9, 12, 15 ], | ||
|
||
]; | ||
|
||
$worksheet->write( 'A1', $data ); | ||
$worksheet->repeat_rows( 0, 1 ); | ||
$worksheet->set_portrait(); | ||
$worksheet->{_vertical_dpi} = 200; | ||
|
||
$chart->add_series( values => [ 'Sheet_1', 0, 4, 0, 0 ] ); | ||
$chart->add_series( values => [ 'Sheet_1', 0, 4, 1, 1 ] ); | ||
$chart->add_series( values => [ 'Sheet_1', 0, 4, 2, 2 ] ); | ||
|
||
$worksheet->insert_chart( 'E9', $chart ); | ||
|
||
$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__ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
############################################################################### | ||
# | ||
# Tests the output of Excel::Writer::XLSX against Excel generated files. | ||
# | ||
# Copyright 2000-2024, John McNamara, [email protected] | ||
# | ||
# 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 = 'quote_name10.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. | ||
# | ||
use Excel::Writer::XLSX; | ||
|
||
my $workbook = Excel::Writer::XLSX->new( $got_filename ); | ||
my $worksheet = $workbook->add_worksheet('Sh.eet.1'); | ||
my $chart = $workbook->add_chart( type => 'column', embedded => 1 ); | ||
|
||
# For testing, copy the randomly generated axis ids in the target xlsx file. | ||
$chart->{_axis_ids} = [ 46905600, 46796800 ]; | ||
|
||
my $data = [ | ||
[ 1, 2, 3, 4, 5 ], | ||
[ 2, 4, 6, 8, 10 ], | ||
[ 3, 6, 9, 12, 15 ], | ||
|
||
]; | ||
|
||
$worksheet->write( 'A1', $data ); | ||
$worksheet->repeat_rows( 0, 1 ); | ||
$worksheet->set_portrait(); | ||
$worksheet->{_vertical_dpi} = 200; | ||
|
||
$chart->add_series( values => [ 'Sh.eet.1', 0, 4, 0, 0 ] ); | ||
$chart->add_series( values => [ 'Sh.eet.1', 0, 4, 1, 1 ] ); | ||
$chart->add_series( values => [ 'Sh.eet.1', 0, 4, 2, 2 ] ); | ||
|
||
$worksheet->insert_chart( 'E9', $chart ); | ||
|
||
$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__ | ||
Oops, something went wrong.