页码的RML测试 [英] RML Test of Page Number

查看:121
本文介绍了页码的RML测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Moin Moin, 我正在使用Openerp 7,并且使用rml创建了pdf. 问题是:我需要页码,但只是第二页的开始. 我尝试了一些rml if子句语句,但是一直打印第1页,而获得printet的东西却很奇怪.

Moin Moin, I'm working on Openerp 7 and there pdf's get created with rml. Problem is: I need Page Numbers, but just starting of the second Page. I tried some rml if clause statements, but Page 1 gets printed all the time and the things that get printet are pretty wierd.

 <header>
    <pageTemplate id="second">

        <frame id="second" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/>

        <pageGraphics>
            <image file="images/isatech_water_header_medium.jpg" x="0.0cm" y="24.4cm" width="19.0cm" height="6.0cm"/>
            <image file="images/isatech_water_footer.jpg" x="0.0cm" y="-0.5cm" width="16.9cm" height="2.6cm"/>
        </pageGraphics>

    </pageTemplate>

    <pageTemplate id="first">  

        <frame id="first" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/>

        <pageGraphics>
            <image file="images/isatech_water_header.jpg" x="0.0cm" y="24.4cm" width="19.0cm" height="6.0cm"/>
            <image file="images/isatech_water_footer.jpg" x="0.0cm" y="-0.5cm" width="16.9cm" height="2.6cm"/>
            [[  <pageNumber/> != '1' and <drawCentredString x="10cm" y="0.3cm"><pageNumber/></drawCentredString> ]]
        </pageGraphics>

    </pageTemplate> 


</header>

在pdf上打印的内容是:

What gets printed on the pdf is:

]] 1(2,3,...)

]] 1(2,3,...)

第二个pageTemplate用于在第1页之后打印不同的页眉.我希望在页码后获得该straigt.

The pageTemplate second is for printing different header after page 1. I hope to get that straigt after the page numbers.

我真的不知道为什么代码表现得像他一样.也欢迎使用不同的解决方案.

I really have no idea why the code behaves like he does. Different solutions are also welcome.

mfg克里斯

推荐答案

我找到了另一种方法. 在RML中检查pageNumber不是一个好主意. 如果我做对了,那么将pageNumber作为最后步骤之一进行处理. (PageCount也是如此,这是有意义的,因为直到构建文档结束,您才知道pageCount) 即使您使用pageNumber调用python函数,它也将作为String处理.我可以想象是同样的原因. 我帮了自己一个<setNextTemplate name="pageTemplate id"/>

I found a different way to do it. It is not a good Idea to check the pageNumber in RML. If I got it right, then the pageNumber is processed as one of the last steps. (Same goes for PageCount where it makes sense as you can't know the pageCount until the end of building your document) Even if you call a python function with a pageNumber it gets handled as a String. I can just imagine it is the same reason. I helped myself with a <setNextTemplate name="pageTemplate id"/>

  1. 在设置">操作">报告">您的报告"中取消选中添加RML标头"
  2. 更改您的RML文件并定义不同的pageTemplates

  1. Uncheck Add RML header in Settings > Actions > Reports > "Your Report"
  2. Change your RML File and define the different pageTemplates

<template title="Sales Order" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20" showBoundary="0">
<pageTemplate id="first">
    <frame id="first" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/>
    <pageGraphics>
        <image file="images/header_page_1.jpg" x="0.8cm" y="24.7cm" width="16,9cm" height="4cm"/>
        <image file="images/footer_page_1.jpg" x="0.4cm" y="-0.4cm" width="16.9cm" height="2.3cm"/>
    </pageGraphics>
</pageTemplate>
<pageTemplate id="second">
    <frame id="first" x1="2.2cm" y1="2.5cm" width="16.9cm" height="22.3cm"/>
    <pageGraphics>
        <image file="images/header_page_2.jpg" x="0.8cm" y="24.7cm" width="16,9cm" height="4cm"/>
        <image file="images/header_page_2.jpg" x="0.4cm" y="-0.4cm" width="16.9cm" height="2.3cm"/>
    </pageGraphics>
</pageTemplate>

第x页的某处添加<setNextTemplate name="pageTemplate id"/><setNextTemplate name="pageTemplate id"/> <nextFrame/>更改页面x + 1的pageTemplate

Somewhere on page x add <setNextTemplate name="pageTemplate id"/> or <setNextTemplate name="pageTemplate id"/> <nextFrame/> to change the pageTemplate of page x+1

<setNextTemplate name="pageTemplate id"/>只需定义下一页的pageTemplate即可, <nextFrame/>另外结束当前页面.

<setNextTemplate name="pageTemplate id"/> simply defines the pageTemplate of the next page and <nextFrame/> additionaly end the current page.

编辑(多公司标题):我有点忘记了我们有多个公司标题.我还是用这种方法.我只是为每个公司复制.rml,然后对不同的公司徽标进行硬编码.然后在每个公司(数据库)的报告设置页面中,我指定了正确的.rml文件. 我很多余,但是没有找到更好的解决方案.

Edit(Multi-Company-Header): I kind of forgot that we have multi Company Headers. Still I use this method. I just copy the .rml for every Company and hardcode the different company logos. Then in the reports setting page for every company(database) I specific the right .rml file. I's very redundant, but I didn't found a better solution.

VG克里斯

这篇关于页码的RML测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆