1 package SL::Template::Excel;
3 use SL::Template::Simple;
7 @ISA = qw(SL::Template::Simple);
12 my $self = $type->SUPER::new(@_);
20 $self->{source} = shift;
21 $self->{form} = shift;
22 $self->{myconfig} = shift;
23 $self->{userspath} = shift;
25 $self->{error} = undef;
27 $self->set_tag_style('<<', '>>');
33 return "application/msexcel";
41 $main::lxdebug->enter_sub();
45 my $form = $self->{"form"};
47 open(IN, "$form->{templates}/$form->{IN}") or do { $self->{"error"} = "$!"; return 0; };
51 my $contents = join("", @lines);
54 $self->{tag_start} [<]* (\s?) [<>\s]* ([\w\s]+) [<>\s]* $self->{tag_end}
56 $self->format_vars(align_right => $1 ne '', varstring => $2, length => length($&), indices => \@indices)
59 if (!defined($contents)) {
60 $main::lxdebug->leave_sub();
66 $main::lxdebug->leave_sub();
71 my ($self, %params) = @_;
72 my $form = $self->{"form"};
73 my @indices = @{ $params{indices} };
74 my $align_right = $params{align_right};
75 my $varstring = $params{varstring};
76 my $length = $params{length};
78 $varstring =~ s/(\w+)/ $self->_get_loop_variable($1, 0, @indices) /eg;
79 my $old_string=$varstring;
80 my $new_string = sprintf "%*s", ($align_right ? 1 : -1 ) * $length, $varstring;
81 if (!defined($new_string) || $new_string eq ''){
82 $main::lxdebug->message(0, 'varstring' . $varstring . "old" . $old_string);
83 # return substr $varstring, ($align_right ? (0, $length) : -$length);
85 return substr $new_string, ($align_right ? (0, $length) : -$length);