1Excel::Template::Plus(3U)ser Contributed Perl DocumentatiEoxncel::Template::Plus(3)
2
3
4
6 Excel::Template::Plus - An extension to the Excel::Template module
7
9 use Excel::Template::Plus;
10
11 my $template = Excel::Template::Plus->new(
12 engine => 'TT',
13 template => 'greeting.tmpl',
14 config => { INCLUDE => [ '/templates' ] },
15 params => { greeting => 'Hello' }
16 );
17
18 $template->param(location => 'World');
19
20 $template->write_file('greeting.xls');
21
23 This is the very first release of this module, it is an idea that I and
24 Rob Kinyon (the author of Excel::Template) had discussed many times,
25 but never got around to doing. This is the first attempt at bring this
26 to reality, it may change radically as it evolves, so be warned.
27
29 This module is an extension of the Excel::Template module, which allows
30 the user to use various "engines" from which you can create Excel files
31 through Excel::Template.
32
33 The idea is to use the existing (and very solid) excel file generation
34 code in Excel::Template, but to extend its more templatey bits with
35 more powerful options.
36
37 The only engine currently provided is the Template Toolkit engine,
38 which replaces Excel::Template's built in template features (the LOOP,
39 and IF constructs) with the full power of TT. This is similar to the
40 module Excel::Template::TT, but expands on that even further to try and
41 create a more extensive system.
42
43 You can use this module to create Excel::Template-compatible XML files
44 using one of the supported engines. For example, with the TT engine you
45 could create a Excel::Template XML file like:
46
47 <workbook>
48 <worksheet name="[% worksheet_name %]">
49 [% my_cols = get_list_of_columns %]
50 <row>
51 [% FOR col = my_cols %]
52 <bold><cell>[% col %]</cell></bold>
53 [% END %]
54 </row>
55 [% FOR my_row = get_list_of_objects %]
56 <row>
57 [% FOR col = my_cols %]
58 <cell>[% my_row.$col %]</cell>
59 [% END %]
60 </row>
61 [% END %]
62 </worksheet>
63 </workbook>
64
65 Your TT template thus creates a XML file suitable to handing over to
66 Excel::Template for processing. Excel::Template::Plus simplifies the
67 template-creation and handing-over process.
68
69 Future engine/plans include:
70
71 Pure Perl
72 This would allow you to write you Excel::Template files using Perl
73 itself which would then output the XML for Excel::Template to
74 consume. This would be modeled after the recently released
75 Template::Declare module perhaps.
76
77 TT Plugins/Macros/Wrappers
78 This is basically anything which will make the TT engine easier to
79 write templates for. I have experimented with some of these things,
80 but I was not happy with any of them enough to release them yet.
81
82 HTML::Template
83 Excel::Template's templating features are based on HTML::Template,
84 but the HTML::Template plugins and other goodies are not
85 compatible. This engine would bring those things to
86 Excel::Template.
87
89 new (%options)
90 This method basically serves as a factory for creating new engine
91 instances (for which Excel::Template::Plus::TT is the only one
92 currently). The only parameter that it requires is engine, all
93 other parameters are passed onto the engine's constructor (see the
94 individual docs for more details on what is required).
95
96 meta
97 Access to the metaclass.
98
100 All complex software has bugs lurking in it, and this module is no
101 exception. If you find a bug please either email me, or add the bug to
102 cpan-RT.
103
105 This module came out of several discussions I had with Rob Kinyon.
106
108 Stevan Little <stevan@cpan.org>
109
111 Copyright 2007-2014 by Infinity Interactive, Inc.
112
113 <http://www.iinteractive.com>
114
115 This library is free software; you can redistribute it and/or modify it
116 under the same terms as Perl itself.
117
118
119
120perl v5.32.0 2020-07-28 Excel::Template::Plus(3)