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