summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Spreadsheet/ParseXLSX.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm
index 037803a..4f33395 100644
--- a/lib/Spreadsheet/ParseXLSX.pm
+++ b/lib/Spreadsheet/ParseXLSX.pm
@@ -721,6 +721,7 @@ sub _extract_files {
my $wb_name = ($rels->find_nodes(
qq<//Relationship[\@Type="$type_base/officeDocument"]>
))[0]->att('Target');
+ $wb_name =~ s{^/}{};
my $wb_xml = $self->_parse_xml($zip, $wb_name);
my $path_base = $self->_base_path_for($wb_name);
@@ -729,25 +730,33 @@ sub _extract_files {
$self->_rels_for($wb_name)
);
+ my $get_path = sub {
+ my ($p) = @_;
+
+ return $p =~ s{^/}{}
+ ? $p
+ : $path_base . $p;
+ };
+
my ($strings_xml) = map {
- $zip->memberNamed($path_base . $_->att('Target'))->contents
+ $zip->memberNamed($get_path->($_->att('Target')))->contents
} $wb_rels->find_nodes(qq<//Relationship[\@Type="$type_base/sharedStrings"]>);
my $styles_xml = $self->_parse_xml(
$zip,
- $path_base . ($wb_rels->find_nodes(
+ $get_path->(($wb_rels->find_nodes(
qq<//Relationship[\@Type="$type_base/styles"]>
- ))[0]->att('Target')
+ ))[0]->att('Target'))
);
my %worksheet_xml = map {
- if ( my $sheetfile = $zip->memberNamed($path_base . $_->att('Target'))->contents ) {
+ if ( my $sheetfile = $zip->memberNamed($get_path->($_->att('Target')))->contents ) {
( $_->att('Id') => $sheetfile );
}
} $wb_rels->find_nodes(qq<//Relationship[\@Type="$type_base/worksheet"]>);
my %themes_xml = map {
- $_->att('Id') => $self->_parse_xml($zip, $path_base . $_->att('Target'))
+ $_->att('Id') => $self->_parse_xml($zip, $get_path->($_->att('Target')))
} $wb_rels->find_nodes(qq<//Relationship[\@Type="$type_base/theme"]>);
return {