reporter: don't try to write Excel formulas
authorgmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 29 Sep 2010 17:48:52 +0000 (17:48 +0000)
committergmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 29 Sep 2010 17:48:52 +0000 (17:48 +0000)
Any cell value that starts with = is now always written
as a text cell in spreadsheet output.  Avoids a possible
exploit as well as errors like this:

Couldn't parse formula: = at /openils/bin/clark-kent.pl line 429

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18101 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/reporter/clark-kent.pl

index 52dc6fd..196297e 100755 (executable)
@@ -423,6 +423,8 @@ sub build_excel {
        $sheetname =~ s/\W/_/gos;
        
        my $sheet = $xls->add_worksheet($sheetname);
+       # don't try to write formulas, just write anything that starts with = as a text cell
+       $sheet->add_write_handler(qr/^=/, sub { return shift->write_string(@_); } );
 
        $sheet->write_row('A1', $r->{column_labels});