Anonymous avatar Anonymous committed 0e2fd45

- added a basic example

Comments (0)

Files changed (2)

examples/basic1.py

+from pyjon.reports import ReportFactory
+
+template = 'basic1.xml'
+testdata = [range(10)] * 100
+
+if __name__ == '__main__':
+    factory = ReportFactory()
+
+    factory.render_template(
+            template_file=template,
+            title=u'THE TITLE',
+            data=testdata,
+            dummy='foo'
+            )
+
+    factory.render_document(
+            'basic1.pdf')
+
+

examples/basic1.xml

+<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?> 
+<!DOCTYPE document SYSTEM "rml_1_0.dtd">
+<document xmlns:py="http://genshi.edgewall.org/">
+	<template pageSize="(595, 842)" leftMargin="72" showBoundary="0">
+		<pageTemplate id="main">
+			<frame id="first" x1="1in" y1="1in" width="6.27in" height="9.69in"/>
+		</pageTemplate>
+	</template>
+	<stylesheet>
+		<blockTableStyle id="mynicetable" spaceBefore="12">
+			<lineStyle kind="OUTLINE" colorName="black" thickness="0.5"/>
+			<blockFont name="Times-Bold" size="6" leading="7" start="0,0" stop="-1,0"/>
+			<blockBottomPadding length="1"/>
+			<blockBackground colorName="0xD0D0D0" start="0,0" stop="-1,0"/>
+			<lineStyle kind="LINEBELOW" colorName="black" start="0,0" stop="-1,0" thickness="0.5"/>
+			<!--body section-->
+			<blockFont name="Times-Roman" size="6" leading="7" start="0,1" stop="-1,-1"/>
+			<blockTopPadding length="1" start="0,1" stop="-1,-1"/>
+			<blockBackground colorsByRow="0xD0FFD0;None" start="0,1" stop="-1,-1"/>
+			<blockAlignment value="right" start="1,1" stop="-1,-1"/>
+			
+			<!-- closing the table when restarting it on next page -->
+			<lineStyle kind="LINEBELOW" colorName="black" start="0,splitlast" stop="-1,splitlast" thickness="0.5"/>
+		</blockTableStyle>
+	</stylesheet>
+	<story>
+        <h1>$title</h1>
+		<blockTable repeatRows="1" style="mynicetable">
+			<tr><td py:for="i in range(10)">Row ${i}</td></tr>
+			<tr py:for="line in data"><td py:for="col in line" py:content="col" /></tr>
+		</blockTable>
+		<para py:content="dummy" />
+	</story>
+</document>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.