1 package Excel::Template::Element::Formula;
7 @ISA = qw(Excel::Template::Element::Cell);
9 use Excel::Template::Element::Cell;
17 my $text = $self->SUPER::get_text($context);
19 # At this point, we must do back-reference dereferencing
29 $context->active_worksheet->write_formula(
30 (map { $context->get($self, $_) } qw(ROW COL)),
31 $self->get_text($context),
42 Excel::Template::Element::Formula - Excel::Template::Element::Formula
46 To write formulas to the worksheet
54 Excel::Template::Element::Cell
62 This is the formula to write to the cell. This can either be text or a parameter
63 with a dollar-sign in front of the parameter name.
67 Optionally, you can specify which column you want this cell to be in. It can be
68 either a number (zero-based) or an offset. See Excel::Template for more info on
69 offset-based numbering.
73 There will be more parameters added, as features are added.
81 This will consume one column on the current row.
89 <formula text="=(1 + 2)"/>
90 <formula>=SUM(A1:A5)</formula>
92 <formula text="$Param2"/>
93 <formula>=(A1 + <var name="Param">)</formula>
95 In the above example, four formulas are written out. The first two have the
96 formula hard-coded. The second two have variables. The third and fourth items
97 have another thing that should be noted. If you have a formula where you want a
98 variable in the middle, you have to use the latter form. Variables within
99 parameters are the entire parameter's value.
103 Rob Kinyon (rob.kinyon@gmail.com)