Estos scripts ya funcionan pero no sé dónde el xml está leyendo @data. No hay un foreach ni nada por el estilo.
Gracias, perleros, de antemano.
Using perl Syntax Highlighting
- #
- # The First Basic Report
- # Cosimo Streppone <[email protected]>
- # 2006-03-14
- #
- # $Id: basic.pl 16 2006-03-27 16:51:09Z cosimo $
- use strict;
- use warnings;
- use PDF::ReportWriter;
- my $rw = PDF::ReportWriter->new();
- my @data = (
- [ 2002, 'Income', 1000.000 ],
- [ 2002, 'Expenses', -900.000 ],
- [ 2002, 'Taxes', -300.000 ],
- [ 2003, 'Income', 2000.000 ],
- [ 2003, 'Expenses', -1200.000 ],
- [ 2003, 'Taxes', -400.000 ],
- [ 2004, 'Income', 4000.000 ],
- [ 2004, 'Expenses', -1800.000 ],
- [ 2004, 'Taxes', -1000.000 ],
- [ 2005, 'Income', 10000.000 ],
- [ 2005, 'Expenses', -3000.000 ],
- [ 2005, 'Taxes', -2300.000 ],
- [ 2006, 'Income (projection)', 90000.000 ],
- [ 2006, 'Expenses (projection)', -9900.000 ],
- [ 2006, 'Taxes (projection)', -15000.000 ],
- );
- $rw->render_report('./basic.xml', \@data);
- # Produces `./basic.pdf', check xml to understand how
- $rw->save();
Coloreado en 0.005 segundos, usando GeSHi 1.0.8.4
Using xml Syntax Highlighting
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <!--
- The First Simple Report
- Author: Cosimo Streppone <[email protected]>
- Date: 2006-03-14
- $Id: basic.xml,v 1.1 2006/03/14 17:14:24 cosimo Exp $
- -->
- <report>
- <definition>
- <name>A simple report</name>
- <destination>basic.pdf</destination>
- <paper>A4</paper>
- <orientation>portrait</orientation>
- <font>Helvetica</font>
- <default_font>Helvetica</default_font>
- <default_font_size>10</default_font_size>
- <x_margin>28.346</x_margin><!-- 10 mm -->
- <y_margin>28.346</y_margin>
- </definition>
- <data>
- <!-- Every rendering unit is a cell -->
- <cell_borders>1</cell_borders>
- <!-- Every page has a header and footer which are
- both lists of individual cells -->
- <page>
- <header>
- <!-- A little logo -->
- <cell index="0">
- <image path="basic.jpg"/>
- <!-- How much space of page? 20% -->
- <percent>20</percent>
- <align>right</align>
- </cell>
- <!-- Main title -->
- <cell index="1">
- <text>My First Simple Report</text>
- <!-- How much space of page? 80% -->
- <percent>80</percent>
- <font_size>20</font_size>
- <colour>blue</colour>
- <align>left</align>
- <wrap_text>1</wrap_text>
- </cell>
- </header>
- </page>
- <!-- A simple report is basically a table.
- Define all the columns of this table -->
- <fields>
- <!-- Year -->
- <field>
- <name>Year\nthing</name>
- <index>0</index>
- <percent>30</percent>
- <font_size>12</font_size>
- <align>left</align>
- </field>
- <!-- Note -->
- <field>
- <name>Note</name>
- <index>1</index>
- <percent>40</percent>
- <font_size>12</font_size>
- <align>left</align>
- </field>
- <!-- Amount -->
- <field>
- <name>Amount</name>
- <index>2</index>
- <percent>30</percent>
- <font_size>12</font_size>
- <align>right</align>
- <format>
- <currency>1</currency>
- <separate_thousands>1</separate_thousands>
- </format>
- </field>
- </fields>
- </data>
- </report>
Coloreado en 0.007 segundos, usando GeSHi 1.0.8.4