[报表开发]如何手动在rml报表里添加页眉页脚
-
问过类似的 http://help.openerp.com/question/18208/how-to-set-different-headerfooter-for-quotationsopoinvoiceetc/ br />
[quote]you can upgrade report .py file just change header=False after that make header and footer whatever you want directly in rml file design it as you want .[/quote]
一直没测试...
应该有直接在rml里指定header和footer的tag? -
可以的,首先要取消系统的页眉页脚,
report_sxw.report_sxw(...., header=False)
然后在你的RML里面手动添加页眉页脚(下面是系统默认自动合成的RML),我们手动的时候就是把这段补进去再进行定制。<br /><document filename="Sales Order.pdf"><br /> <template title="Sales Order" author="OpenERP S.A.([email protected])" allowSplitting="20"><br /> <!--页眉页脚--><br /> <frame id="first" x1="1.3cm" y1="3.0cm" height="21.7cm" width="19.0cm"><br /> </frame><br /> <stylesheet><br /> <!-- Set here the default font to use for all <para> tags --><br /> <paraStyle name="Normal" fontName="DejaVu Sans"><br /> </paraStyle><br /> <paraStyle name="main_footer" fontSize="8.0" alignment="CENTER"><br /> </paraStyle><br /> <paraStyle name="main_header" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"><br /> </paraStyle><br /> </stylesheet><br /> <pageGraphics><br /> <!-- Set here the default font to use for all <drawString> tags --><br /> <setFont name="DejaVu Sans" size="8"><br /> </setFont><br /> <!-- You Logo - Change X,Y,Width and Height --><br /> <image x="1.3cm" y="27.7cm" height="40.0" rml_except=" company.logo or removeParentNode('image') ">[[ company.logo or removeParentNode('image') ]]</image><br /> <fill color="black"><br /> </fill><br /> <stroke color="black"><br /><br /> </stroke><br /><br /> <!-- page header --><br /> <lines>1.3cm 27.7cm 20cm 27.7cm</lines><br /> <drawRightString x="20cm" y="27.8cm">[[ company.rml_header1 ]]</drawRightString><br /> <drawString x="1.3cm" y="27.3cm">[[ company.partner_id.name ]]</drawString><br /> <place x="1.3cm" y="25.3cm" height="1.8cm" width="15.0cm"><br /> <para style="main_header">[[ display_address(company.partner_id) or '' ]]</para><br /> </place><br /> <drawString x="1.3cm" y="25.0cm">Phone:</drawString><br /> <drawRightString x="7cm" y="25.0cm">[[ company.partner_id.phone or '' ]]</drawRightString><br /> <drawString x="1.3cm" y="24.6cm">Mail:</drawString><br /> <drawRightString x="7cm" y="24.6cm">[[ company.partner_id.email or '' ]]</drawRightString><br /> <lines>1.3cm 24.5cm 7cm 24.5cm</lines><br /><br /> <!-- left margin --><br /> <rotate degrees="90"><br /> </rotate><br /> <fill color="grey"><br /> </fill><br /> <drawString x="2.65cm" y="-0.4cm">generated by OpenERP.com</drawString><br /> <fill color="black"><br /> </fill><br /> <rotate degrees="-90"><br /><br /> </rotate><br /><br /> <!--page bottom--><br /> <lines>1.2cm 2.65cm 19.9cm 2.65cm</lines><br /> <place x="1.3cm" y="0cm" height="2.55cm" width="19.0cm"><br /> <para style="main_footer">[[ company.rml_footer ]]</para><br /> <para style="main_footer">Contact : [[ user.name ]] - Page: <pageNumber/></para><br /> </place><br /> </pageGraphics><br /><br /> </template><br />
-
从其他帖子引流过来的,先mark了,刚开发入门,后续报表开发用得着