[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1667] trunk/LedgerSMB/Template/ODS.pm



Revision: 1667
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1667&view=rev
Author:   tetragon
Date:     2007-09-26 10:05:44 -0700 (Wed, 26 Sep 2007)

Log Message:
-----------
Fix style naming bug

Modified Paths:
--------------
    trunk/LedgerSMB/Template/ODS.pm

Modified: trunk/LedgerSMB/Template/ODS.pm
===================================================================
--- trunk/LedgerSMB/Template/ODS.pm	2007-09-26 16:27:18 UTC (rev 1666)
+++ trunk/LedgerSMB/Template/ODS.pm	2007-09-26 17:05:44 UTC (rev 1667)
@@ -92,8 +92,16 @@
 
 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 _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_cleanup_handler {
 	my ($t, $format) = @_;
 	shift @style_stack;
+	$t->purge;
 }
 
 sub _ods_process {
@@ -742,6 +751,7 @@
 			worksheet => \&_worksheet_handler,
 			row => \&_row_handler,
 			cell => \&_cell_handler,
+			formula => \&_cell_handler,
 			format => \&_format_handler,
 			},
 		twig_handlers => {
@@ -749,7 +759,7 @@
 			}
 		);
 	$parser->parse($template);
-	$parser->flush;
+	$parser->purge;
 	$ods->save;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.