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