PDA

View Full Version : itemband & page-footer : bottom margin problem



bisa
09-06-2003, 05:59 AM
hi all

i'm having some problem managing the bottommargin with itemband and page-footer:

my application should print on a pre-printed bill module (with a pre-formatted table with n-rows and m columns), and it should follow the module margins.

so i use the itemband to display all the items of the bill and the page-footer to display the total charge of it.

i need the page footer as on the bottom of the page as possible, but, when i move it the itemband moves too, and i get the last itemband item printed over the pre-printed line that separes the itemband with the page footer.

viceversa, if i try to get my itemband more on the top of the page also the page footer moves....

is there a way to set a space between itemband and page-footer or a way to move only an item (page-footer or itemband) without moving the other?



this is the xml file code:



<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE report-definition PUBLIC "-//JFreeReport//DTD report definition//EN//extended" "http&#58;//jfreereport.sourceforge.net/extreport.dtd">

<report-definition name="First Report">




<parser-config>
<object-factory class="com.jrefinery.report.io.ext.factory.objects.DefaultClassFactory"/>
<element-factory class="com.jrefinery.report.io.ext.factory.elements.DefaultElementFactory"/>
<stylekey-factory class="com.jrefinery.report.io.ext.factory.stylekey.DefaultStyleKeyFactory"/>
<stylekey-factory class="com.jrefinery.report.io.ext.factory.stylekey.PageableLayoutStyleKeyFactory"/>
<template-factory class="com.jrefinery.report.io.ext.factory.templates.DefaultTemplateCollection"/>
<datasource-factory class="com.jrefinery.report.io.ext.factory.datasource.DefaultDataSourceFactory"/>
</parser-config>




<report-config>
<defaultpageformat orientation="portrait" pageformat="A4" topmargin="72" bottommargin="70" leftmargin="34" rightmargin="35"/>
</report-config>




<report-description>



<page-header>

<style>
<compound-key name="min-size">
<basic-object name="height">18.0</basic-object>
<basic-object name="width">0.0</basic-object>
</compound-key>
<basic-key name="display-on-lastpage">true</basic-key>
<basic-key name="display-on-firstpage">true</basic-key>
</style>

<default-style>
<basic-key name="font-bold">false</basic-key>
<basic-key name="font-size">9</basic-key>
<basic-key name="font">Tahoma</basic-key>
<basic-key name="font-italic">false</basic-key>
</default-style>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">293.0</basic-object>
<basic-object name="y">120.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<basic-key name="dynamic_height">true</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">-100</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">ragSoc</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">293.0</basic-object>
<basic-object name="y">130.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">-100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">indirizzo</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">293.0</basic-object>
<basic-object name="y">140.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">-100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">localita</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">293.0</basic-object>
<basic-object name="y">150.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">-100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">nazione</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">54.0</basic-object>
<basic-object name="y">150.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">-100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">nFattura</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">150.0</basic-object>
<basic-object name="y">150.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">-100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">dataFattura</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">0.0</basic-object>
<basic-object name="y">190.0</basic-object>
</compound-key>
<basic-key name="dynamic_height">true</basic-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">220.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">modPag</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">360.0</basic-object>
<basic-object name="y">200.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">-100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">codice</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">100.0</basic-object>
<basic-object name="y">265.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<basic-key name="font-size">8</basic-key>
<compound-key name="min-size">
<basic-object name="height">50.0</basic-object>
<basic-object name="width">300.0</basic-object>
</compound-key>
<basic-key name="valignment">top</basic-key>
</style>
<template references="string-field">
<basic-object name="field">intestazione</basic-object>
<basic-object name="nullValue">-</basic-object>
</template>
</element>

</page-header>




<page-footer>

<style>
<basic-key name="display-on-lastpage">true</basic-key>
<compound-key name="min-size">
<basic-object name="height">14.0</basic-object>
<basic-object name="width">0.0</basic-object>
</compound-key>
</style>

<band name="summary">
<default-style>
<basic-key name="font-bold">false</basic-key>
<basic-key name="font-size">8</basic-key>
<basic-key name="font">Tahoma</basic-key>
<basic-key name="font-italic">false</basic-key>
</default-style>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">50.0</basic-object>
<basic-object name="y">300.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">imponibile</basic-object>
<basic-object name="nullValue"></basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">140.0</basic-object>
<basic-object name="y">300.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">ivaPerc</basic-object>
<basic-object name="nullValue"></basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">200.0</basic-object>
<basic-object name="y">300.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">iva</basic-object>
<basic-object name="nullValue"></basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">250.0</basic-object>
<basic-object name="y">300.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">nonImponibile</basic-object>
<basic-object name="nullValue"></basic-object>
</template>
</element>

<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">490.0</basic-object>
<basic-object name="y">300.0</basic-object>
</compound-key>
<basic-key name="alignment">left</basic-key>
<compound-key name="min-size">
<basic-object name="height">9.0</basic-object>
<basic-object name="width">100.0</basic-object>
</compound-key>
<basic-key name="valignment">bottom</basic-key>
</style>
<template references="string-field">
<basic-object name="field">totale</basic-object>
<basic-object name="nullValue"></basic-object>
</template>
</element>

</band>
</page-footer>




<itemband>


<style>
<compound-key name="min-size">
<basic-object name="height">10.0</basic-object>
<basic-object name="width">0.0</basic-object>
</compound-key>
</style>


<default-style>
<basic-key name="font">Tahoma</basic-key>
<basic-key name="font-size">8</basic-key>
<basic-key name="font-bold">false</basic-key>
<basic-key name="font-italic">false</basic-key>
</default-style>



<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">0.0</basic-object>
<basic-object name="y">0.0</basic-object>
</compound-key>
<basic-key name="dynamic_height">false</basic-key>
<compound-key name="min-size">
<basic-object name="height">10.0</basic-object>
<basic-object name="width">-50.0</basic-object>
</compound-key>
<basic-key name="paint">black</basic-key>
<basic-key name="alignment">left</basic-key>
<basic-key name="valignment">top</basic-key>
</style>
<template references="string-field">
<basic-object name="nullValue">-</basic-object>
<basic-object name="field">Data</basic-object>
</template>
</element>


<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">100.0</basic-object>
<basic-object name="y">0.0</basic-object>
</compound-key>
<basic-key name="dynamic_height">false</basic-key>
<compound-key name="min-size">
<basic-object name="height">10.0</basic-object>
<basic-object name="width">300.0</basic-object>
</compound-key>
<basic-key name="paint">black</basic-key>
<basic-key name="alignment">left</basic-key>
<basic-key name="valignment">top</basic-key>
</style>
<template references="string-field">
<basic-object name="nullValue">-</basic-object>
<basic-object name="field">Descrizione</basic-object>
</template>
</element>


<element type="text/plain">
<style>
<compound-key name="absolute_pos">
<basic-object name="x">430.0</basic-object>
<basic-object name="y">0.0</basic-object>
</compound-key>
<basic-key name="dynamic_height">false</basic-key>
<compound-key name="min-size">
<basic-object name="height">10.0</basic-object>
<basic-object name="width">100.0</basic-object>
</compound-key>
<basic-key name="paint">black</basic-key>
<basic-key name="alignment">right</basic-key>
<basic-key name="valignment">top</basic-key>
</style>
<template references="string-field">
<basic-object name="nullValue">-</basic-object>
<basic-object name="field">Importo</basic-object>
</template>
</element>
</itemband>
</report-description>




<functions>

<property-ref name="report.date"/>
<property-ref name="ragSoc"/>
<property-ref name="indirizzo"/>
<property-ref name="localita"/>
<property-ref name="nazione"/>
<property-ref name="modPag"/>
<property-ref name="pIva"/>
<property-ref name="nFattura"/>
<property-ref name="dataFattura"/>
<property-ref name="codice"/>
<property-ref name="intestazione"/>
<property-ref name="imponibile"/>

<property-ref name="nonImponibile"/>
<property-ref name="iva"/>
<property-ref name="ivaPerc"/>
<property-ref name="totale"/>


<function name="hide-function" class="code.fatturazione.PageFooterHideFunction">
<properties>
<property name="element">summary</property>
</properties>
</function>


</functions>

</report-definition>





thanx a lot

Taqua
09-06-2003, 11:06 AM
Hi,

you can redefine your pagefooter to reserve the required space.

If you define the elements of your footer to start at y=20, then your footer will have an empty area of 20 points height on its top.

The page footer is always placed at the bottom of the page, so it would not move :) But the itembands try to fill as much of the page as possible, and if you start to reduce the bottom margin, the pagefooter will be printed at the new margin (as expected). The itembands of course will happily fill the new space and so you are where you were before :)

All your elements start at y=300, this means that your page footer will always be at least 300 points high, leaving an empty area of 300 points on the top of any content. Is this really what you want?

Have more fun,
said Thomas

Anonymous
09-08-2003, 04:22 AM
hi taqua!
yes, i need my page-footer elements to start at y=300, because my report will be printed on a pre-formatted (and pre-printed) bill module.
for the same reason i need a certain distance between them and the last itemband item.
in this space the pre-printed elements (like: "bill total:" and so on) will take place, and after them i'd like to place my page-footer items.


any hint?

bisa
09-11-2003, 07:03 AM
please taqua.... :cry:

thanx :D

Taqua
09-11-2003, 11:40 AM
Hi,

You will have to do some mathematics to place page footer elements on a certain page position:

Position = PageHeight - BottomMargin - PageFooterHeight + elementY_in_the_pagefooter

The page footer height, if not defined otherwise is the maximum of "element_y + element_height" over all elements of the page footer.

Your report is defined to be printed on "A4" pageformat. A4 has a height of 842 points.

The bottom margin is defined to be 70 points in your report.

The page footers minimum height is 14pt, but the elements defined in the footer will increase the height. All elements are defined at y=300 and have a height of 9, so your page footer will have a height of 309 points after layouting.

Following to formula above, your elements will be printed on

pos = (842 - 70 - 309 + 300)
= 763

As I don't know, on which absolute position on the paper the element should be printed, I'll leave it up to you to tweak the numbers of the fomula above. :)

Have more fun,
said Thomas