1 package SL::Template::Excel;
4 use parent qw(SL::Template::Simple);
9 my $self = $type->SUPER::new(@_);
17 $self->{source} = shift;
18 $self->{form} = shift;
19 $self->{myconfig} = shift;
20 $self->{userspath} = shift;
22 $self->{error} = undef;
24 $self->set_tag_style('<<', '>>');
30 return "application/msexcel";
38 $main::lxdebug->enter_sub();
42 my $form = $self->{"form"};
44 open(IN, "$form->{templates}/$form->{IN}") or do { $self->{"error"} = "$!"; return 0; };
48 my $contents = join("", @lines);
51 $self->{tag_start} [<]* (\s?) [<>\s]* ([\w\s]+) [<>\s]* $self->{tag_end}
53 $self->format_vars(align_right => $1 ne '', varstring => $2, length => length($&), indices => \@indices)
56 if (!defined($contents)) {
57 $main::lxdebug->leave_sub();
63 $main::lxdebug->leave_sub();
68 my ($self, %params) = @_;
69 my $form = $self->{"form"};
70 my @indices = @{ $params{indices} };
71 my $align_right = $params{align_right};
72 my $varstring = $params{varstring};
73 my $length = $params{length};
75 $varstring =~ s/(\w+)/ $self->_get_loop_variable($1, 0, @indices) /eg;
76 my $old_string=$varstring;
77 my $new_string = sprintf "%*s", ($align_right ? 1 : -1 ) * $length, $varstring;
78 return substr $new_string, ($align_right ? (0, $length) : -$length);