Skip to content

Commit

Permalink
Item2454: restore graceful failure if unable to parse XLSX because of…
Browse files Browse the repository at this point in the history
… missing prerequisites

git-svn-id: http://svn.foswiki.org/trunk/StringifierContrib@9726 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
WillNorris authored and WillNorris committed Oct 25, 2010
1 parent 434f69b commit 8f7349d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/Foswiki/Contrib/StringifierContrib/Plugins/XLSX.pm
Expand Up @@ -20,7 +20,6 @@ __PACKAGE__->register_handler("application/vnd.openxmlformats-officedocument.spr

use Text::Iconv;
use Encode ();
use Spreadsheet::XLSX;
use Error qw(:try);

sub stringForFile {
Expand All @@ -29,11 +28,16 @@ sub stringForFile {
#my $converter = Text::Iconv->new("utf-8", "windows-1251");
my $book;

try {
require Spreadsheet::XLSX;
} catch Error with {
return '';
}

try {
$book = Spreadsheet::XLSX->new($file);
}
catch Error with {

# file not opened, possibly passworded
return '';
};
Expand Down

0 comments on commit 8f7349d

Please sign in to comment.