diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-26 17:05:44 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-26 17:05:44 +0000 |
commit | d6b8b1b013f35294da2b035c9ce8cf6d44ec3ddc (patch) | |
tree | 3e5457d240a0f87dd527834e0e836e5838bc2793 /LedgerSMB | |
parent | 0159928dccee04cfa7d7e6467ffda3039962d9be (diff) |
Fix style naming bug
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1667 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/Template/ODS.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/LedgerSMB/Template/ODS.pm b/LedgerSMB/Template/ODS.pm index 91141582..144762e8 100644 --- a/LedgerSMB/Template/ODS.pm +++ b/LedgerSMB/Template/ODS.pm @@ -92,8 +92,16 @@ sub _row_handler { sub _cell_handler { my $cell = $ods->getCell(-1, $rowcount, $currcol); + if (@style_stack and $celltype{$style_stack[0][0]}) { $ods->cellValueType($cell, $celltype{$style_stack[0][0]}[0]); + } elsif ($_->{att}->{type}) { + my $type = $_->{att}->{type}; + if ($type =~ /^(string|blank|url)$/i) { + $ods->cellValueType($cell, 'string'); + } elsif ($type =~ /^(number|formula)$/i) { + $ods->cellValueType($cell, 'float'); + } } $ods->cellValue($cell, $_->{att}->{text}); if (@style_stack) { @@ -183,7 +191,7 @@ sub _create_positive_style { sub _format_handler { my ($t, $format) = @_; - my $style = sprintf "ce%d", (length(keys %style_table) + 1); + my $style = sprintf "ce%d", (scalar (keys %style_table) + 1); my @extras; local @width = ('none', '0.018cm solid', '0.035cm solid', @@ -719,6 +727,7 @@ sub _format_handler { sub _format_cleanup_handler { my ($t, $format) = @_; shift @style_stack; + $t->purge; } sub _ods_process { @@ -742,6 +751,7 @@ sub _ods_process { worksheet => \&_worksheet_handler, row => \&_row_handler, cell => \&_cell_handler, + formula => \&_cell_handler, format => \&_format_handler, }, twig_handlers => { @@ -749,7 +759,7 @@ sub _ods_process { } ); $parser->parse($template); - $parser->flush; + $parser->purge; $ods->save; } |