1 package Excel::Template::Element::Cell;
7 @ISA = qw(Excel::Template::Element);
9 use Excel::Template::Element;
15 my $self = $class->SUPER::new(@_);
17 $self->{TXTOBJ} = Excel::Template::Factory->create('TEXTOBJECT');
27 my $txt = $context->get($self, 'TEXT');
30 my $txt_obj = Excel::Template::Factory->create('TEXTOBJECT');
31 push @{$txt_obj->{STACK}}, $txt;
32 $txt = $txt_obj->resolve($context);
34 elsif ($self->{TXTOBJ})
36 $txt = $self->{TXTOBJ}->resolve($context)
40 UNI_YES $txt = Unicode::String::utf8('');
52 my ($row, $col) = map { $context->get($self, $_) } qw(ROW COL);
54 my $ref = uc $context->get( $self, 'REF' );
55 if (defined $ref && length $ref)
57 $context->add_reference( $ref, $row, $col );
60 $context->active_worksheet->write(
62 $self->get_text($context),
63 $context->active_format,
81 Excel::Template::Element::Cell - Excel::Template::Element::Cell
85 To actually write stuff to the worksheet
93 Excel::Template::Element
101 This is the text to write to the cell. This can either be text or a parameter
102 with a dollar-sign in front of the parameter name.
106 Optionally, you can specify which column you want this cell to be in. It can be
107 either a number (zero-based) or an offset. See Excel::Template for more info on
108 offset-based numbering.
112 There will be more parameters added, as features are added.
116 Excel::Template::Element::Formula
120 This will consume one column on the current row.
128 <cell text="Some Text Here"/>
129 <cell>Some other text here</cell>
131 <cell text="$Param2"/>
132 <cell>Some <var name="Param"> text here</cell>
134 In the above example, four cells are written out. The first two have text hard-
135 coded. The second two have variables. The third and fourth items have another
136 thing that should be noted. If you have text where you want a variable in the
137 middle, you have to use the latter form. Variables within parameters are the
138 entire parameter's value.
140 Please see Spreadsheet::WriteExcel for what constitutes a legal formula.
142 =head1 BACK-REFERENCES
144 Currently, you can only use a hard-coded formula. The next release will add the
145 capability to have a formula reference other nodes in the template dynamically.
149 Rob Kinyon (rob.kinyon@gmail.com)