Made Spreadsheet::WriteExcel links in format docs more generic
[p5sagit/Excel-Template.git] / lib / Excel / Template / Container / Format.pm
CommitLineData
d0eafc11 1package Excel::Template::Container::Format;
2
3use strict;
4
5BEGIN {
6 use vars qw(@ISA);
7 @ISA = qw( Excel::Template::Container );
8
9 use Excel::Template::Container;
10}
11
12use Excel::Template::Format;
13
14sub render
15{
16 my $self = shift;
17 my ($context) = @_;
18
19 my $old_format = $context->active_format;
d0eafc11 20
1aa9e458 21 my %values;
22 while ( my ($k, $v) = each %$self ) {
23 $values{$k} = $context->resolve( $self, $k );
24 }
25
26 my $format = $context->format_object->copy(
27 $context, $old_format, %values,
d0eafc11 28 );
29 $context->active_format($format);
30
31 my $child_success = $self->iterate_over_children($context);
32
33 $context->active_format($old_format);
c09684ff 34
35 return $child_success;
d0eafc11 36}
37
381;
39__END__
40
41=head1 NAME
42
43Excel::Template::Container::Format - Excel::Template::Container::Format
44
45=head1 PURPOSE
46
47To format all children according to the parameters
48
49=head1 NODE NAME
50
51FORMAT
52
53=head1 INHERITANCE
54
55Excel::Template::Container
56
57=head1 ATTRIBUTES
58
c09684ff 59Boolean attributes should be set to 1, 0, true, or false.
60
614e6e6c 61Color values can be the color name or the color index. See L<Spreadsheet::WriteExcel/"COLOURS IN EXCEL">
c09684ff 62
6dd4c89d 63=over 4
c09684ff 64
65=item * align
66
67Set to either left, center, right, fill, or justify. Default is left. See also valign.
68
69=item * bg_color
70
71Set to a color value. Default is none.
72
d0eafc11 73=item * bold
74
75This will set bold to on or off, depending on the boolean value.
76
c09684ff 77=item * border
d0eafc11 78
c09684ff 79Set the border for all for edges of a cell. Also see bottom, top, left, and right.
80Valid values are 0 - 7.
d0eafc11 81
614e6e6c 82See L<Spreadsheet::WriteExcel/"set_border()">
d0eafc11 83
c09684ff 84=item * border_color
85
86Sets the color value for the border. See also border, top_color, bottom_color, left_color
87and right_color.
88
89=item * bottom
90
91See border.
92
93=item * bottom_color
94
95See border_color
96
97=item * color
98
99This will set the color of the text, depending on color value. Default is black.
100
101=item * fg_color
102
103Set to a color value. This color will be used in foreground of some patterns. See color
104to change the color of text. Also see bg_color and pattern.
105
106=item * font
107
108This will sent the font face. Default is Arial.
d0eafc11 109
110=item * font_outline
111
112This will set font_outline to on or off, depending on the boolean value. (q.v.
113OUTLINE tag)
114
115=item * font_shadow
116
117This will set font_shadow to on or off, depending on the boolean value. (q.v.
c09684ff 118SHADOW tag). This only applies to Excel for Macintosh.
d0eafc11 119
120=item * font_strikeout
121
122This will set font_strikeout to on or off, depending on the boolean value. (q.v.
123STRIKEOUT tag)
124
c09684ff 125=item * hidden
126
127This will set whether the cell is hidden to on or off, depending on the boolean
128value.
129
130=item * indent
131
132Set the indentation level for a cell. Positive integers are allowed.
133
134=item * italic
135
136This will set italic to on or off, depending on the boolean value. (q.v. ITALIC
137tag)
138
139=item * left
140
141See border.
142
143=item * left_color
144
145See border_color.
146
147=item * num_format
148
614e6e6c 149Set to the index of one of Excel's built-in number formats. See L<Spreadsheet::WriteExcel/"set_num_format()">
c09684ff 150
151=item * pattern
152
153Set to an integer, 0 - 18. Sets the background fill pattern of a ell. Default is 1, solid.
154
155=item * right
156
157See border.
158
159=item * right_color
160
161See border color.
162
163=item * rotation
164
165Set the rotation of the text in a cell. The rotation can be any angle in the range -90 to 90 degrees.
166The angle 270 is also supported. This indicates text where the letters run from top to bottom.
167
168=item * shrink
169
170A boolean value. If true, text will shrink to fit a cell.
171
172=item * size
173
174This will set the size of the font. Default is 10. Unless a row height is
175specifically set, the row will grow taller as necessary.
176
177=item * text_justlast
178
179A boolean value to justify the last line. Only applies to Far Eastern versions of Excel.
180
181=item * text_wrap
182
183A boolean value. When set to true, text will wrap in a cell instead of crossing over
184into empty cells. If the row height is not set, the row will grow taller to accomodate
185the wrapping text.
186
187=item * top
188
189See border.
190
191=item * top_color
192
193See border_color
194
195=item * valign
196
197Set to top, vcenter, bottom, or vjustify. Default is vcenter. See also align.
198
6dd4c89d 199=back
d0eafc11 200
201=head1 CHILDREN
202
203None
204
205=head1 EFFECTS
206
207None
208
209=head1 DEPENDENCIES
210
211None
212
213=head1 USAGE
214
215 <format bold="1">
216 ... Children here
217 </format>
218
219In the above example, the children will be displayed (if they are displaying
220elements) in a bold format. All other formatting will remain the same and the
221"bold"-ness will end at the end tag.
222
223=head1 AUTHOR
224
c09684ff 225Rob Kinyon (rob.kinyon@gmail.com)
d0eafc11 226
227=head1 SEE ALSO
228
229BOLD, HIDDEN, ITALIC, OUTLINE, SHADOW, STRIKEOUT
230
231=cut