Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » watermark and company stamp
watermark and company stamp [message #549897] Wed, 28 July 2010 11:54 Go to next message
pigargo is currently offline pigargoFriend
Messages: 14
Registered: May 2010
Junior Member
Hallo,

I want to print a watermark and a company stamp on my report.

For both i can use the background image on the master page. But I don't have found any possibility to take an image from the filesystem which is defined in a report datasetrow.

And then I have a problem to set the visibility of the image. There is no visibility definition on the background image and also not on the master page. But the watermark "copie" only should be printed, if the parameter P_ORIGINAL is not set.

Is there any way to solve this problems?

Thanks for your help.

pigargo

[Updated on: Wed, 28 July 2010 11:54]

Report message to a moderator

Re: watermark and company stamp [message #550000 is a reply to message #549897] Wed, 28 July 2010 17:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If the image did not need to be dynamic based on row data you would just
use some de api in the before factory to set it like:
reportContext.getDesignHandle().findMasterPage("myMasterPage ").setProperty("backgroundImage",
"file://C:\\work\\oldblogs\\My Pictures\\birtlogo.png" );

But since you want it dynamic try this approach.

One way to handle this is to start with a 1x1 grid and set its height
and width to 100%. Create a new style with a background image set in it
and apply it to the grid. Drop your table data inside the grid. You
can then just disable the background image in the onCreate script of the
grid like:

if( !params["showWM"].value ){
this.getStyle().backgroundImage = "";
}

If you want the background image path to come from the row data, this is
a bit tricky as the grid is already processed before your table is. To
get around this place a hidden table above the grid that does the
background image location calculation. for example I could add the
hidden table with an onCreate script on the row like:

var qty = this.getRowData().getColumnValue("QUANTITYORDERED");
if( qty > 40 ){
SwapBGI = true;
}
Withouth the var keyword SwapBGI is now global. I can then use this
variable in my grid oncreate.

if( SwapBGI ){
this.getStyle().backgroundImage="c:/dwn/Jellyfish.jpg";
}
if( !params["showWM"].value ){
this.getStyle().backgroundImage = "";
}

The only other thing you need to do is to set SwapBGI to false in the
onPrepare of the grid

SwapBGI = false;

See the attached example.

Jason


<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.21"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.6.0.v20100531 Build &lt;2.6.0.v20100609-1613></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<parameters>
<scalar-parameter name="showWM" id="48">
<property name="valueType">static</property>
<property name="dataType">boolean</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="constant">true</value>
</simple-property-list>
<property name="paramType">simple</property>
<property name="controlType">check-box</property>
<structure name="format"/>
</scalar-parameter>
</parameters>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="7">
<list-property name="privateDriverProperties">
<ex-property>
<name>contentBidiFormatStr</name>
<value>ILYNN</value>
</ex-property>
<ex-property>
<name>metadataBidiFormatStr</name>
<value>ILYNN</value>
</ex-property>
</list-property>
<property
name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="8">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<text-property
name="heading">ORDERNUMBER</text-property>
<property name="displayLength">11</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<text-property
name="heading">PRODUCTCODE</text-property>
<property name="displayLength">15</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<text-property
name="heading">QUANTITYORDERED</text-property>
<property name="displayLength">11</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<text-property name="heading">PRICEEACH</text-property>
<property name="displayLength">22</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<text-property
name="heading">ORDERLINENUMBER</text-property>
<property name="displayLength">6</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="dataType">float</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">5</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select *
from orderdetails
]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRODUCTCODE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRODUCTCODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRODUCTCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>QUANTITYORDERED</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>QUANTITYORDERED</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>QUANTITYORDERED</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRICEEACH</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRICEEACH</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRICEEACH</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERLINENUMBER</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>5</design:nativeDataTypeCode>
<design:precision>5</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERLINENUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERLINENUMBER</design:label>
<design:formattingHints>
<design:displaySize>6</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>
]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="NewStyle" id="9">
<property name="backgroundImage">c:/dwn/Koala.jpg</property>
<property name="backgroundRepeat">no-repeat</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table id="49">
<property name="dataSet">Data Set</property>
<list-property name="visibility">
<structure>
<property name="format">all</property>
<expression name="valueExpr"
type="javascript">true</expression>
</structure>
</list-property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<expression name="expression"
type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<column id="78"/>
<column id="79"/>
<column id="80"/>
<column id="81"/>
<column id="82"/>
<header>
<row id="83">
<cell id="84">
<property name="colSpan">5</property>
<property name="rowSpan">1</property>
<label id="89">
<text-property name="text">This table is
hidden an just used to calculate the background image for the grid
below. Look at the on create method of the row.</text-property>
</label>
</cell>
</row>
<row id="50">
<cell id="51">
<label id="52">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="53">
<label id="54">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="55">
<label id="56">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="57">
<label id="58">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="59">
<label id="60">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="61">
<method name="onCreate"><![CDATA[var qty =
this.getRowData().getColumnValue("QUANTITYORDERED");
if( qty > 40 ){
SwapBGI = true;
}]]></method>
<cell id="62">
<data id="63">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="64">
<data id="65">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="66">
<data id="67">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="68">
<data id="69">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="70">
<data id="71">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="72">
<cell id="73"/>
<cell id="74"/>
<cell id="75"/>
<cell id="76"/>
<cell id="77"/>
</row>
</footer>
</table>
<grid id="10">
<property name="style">NewStyle</property>
<property name="height">100%</property>
<property name="width">100%</property>
<method name="onPrepare"><![CDATA[SwapBGI = false;]]></method>
<method name="onCreate"><![CDATA[if( SwapBGI ){
this.getStyle().backgroundImage="c:/dwn/Jellyfish.jpg";
}
if( !params["showWM"].value ){
this.getStyle().backgroundImage = "";
}]]></method>
<column id="11"/>
<row id="12">
<cell id="13">
<table id="14">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property
name="name">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERNUMBER"]</expression >
<property
name="dataType">integer</property>
</structure>
<structure>
<property
name="name">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property
name="name">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<expression name="expression"
type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
<property
name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property
name="name">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERLINENUMBER"]</expression >
<property
name="dataType">integer</property>
</structure>
</list-property>
<column id="43"/>
<column id="44"/>
<column id="45"/>
<column id="46"/>
<column id="47"/>
<header>
<row id="15">
<cell id="16">
<label id="17">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="18">
<label id="19">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="20">
<label id="21">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="22">
<label id="23">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="24">
<label id="25">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="26">
<cell id="27">
<data id="28">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="29">
<data id="30">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="31">
<data id="32">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="33">
<data id="34">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="35">
<data id="36">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="37">
<cell id="38"/>
<cell id="39"/>
<cell id="40"/>
<cell id="41"/>
<cell id="42"/>
</row>
</footer>
</table>
</cell>
</row>
</grid>
</body>
</report>




On 7/28/2010 7:54 AM, pigargo wrote:
> Hallo,
>
> I want to print a watermark and a company stamp on my report.
> For both i can use the background image on the master page. But I don't
> have found any possibility to take an image from the filesystem which is
> defined in a report datasetrow.
> And then I have a problem to set the visibility of the image. There is
> no visibility definition on the background image and also not on the
> master page. But the watermark "copie" only should be printed, if the
> parameter P_ORIGINAL is not set.
>
> Is there any way to solve this problems?
>
> Thanks for your help.
Re: watermark and company stamp [message #550139 is a reply to message #549897] Thu, 29 July 2010 09:27 Go to previous messageGo to next message
pigargo is currently offline pigargoFriend
Messages: 14
Registered: May 2010
Junior Member
Hallo Jason,

thank you very much. This was a big help for me.

But now I have two problems.

1) My background image will fill the whole page. Now I have limited the data, so that they will fill only the half page. What's happen? The background image is printed only for the half page.

2) If the image is not so big to fill the whole page I will stretch it to the size of the grid. So I set the values background size height and background size width to contain. The image was contained in preview and html, but not in pdf.

I am using birt 2.5.2, will this be a bug?

pigargo
Re: watermark and company stamp [message #550220 is a reply to message #550139] Thu, 29 July 2010 14:44 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Set the grid height to like 10 in and then select the grid row and set
its height to 9 in. You can test with different numbers, but if they
are bigger than the page you will get the error you are seeing. Take a
look at the modified example I am attaching.

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.21"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.5.2.v20100208 Build &lt;2.5.2.v20100210-0630></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="layoutPreference">fixed layout</property>
<property name="bidiLayoutOrientation">ltr</property>
<property name="imageDPI">96</property>
<parameters>
<scalar-parameter name="showWM" id="48">
<property name="valueType">static</property>
<property name="dataType">boolean</property>
<property name="distinct">true</property>
<simple-property-list name="defaultValue">
<value type="constant">true</value>
</simple-property-list>
<property name="paramType">simple</property>
<property name="controlType">check-box</property>
<structure name="format"/>
</scalar-parameter>
</parameters>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="7">
<list-property name="privateDriverProperties">
<ex-property>
<name>contentBidiFormatStr</name>
<value>ILYNN</value>
</ex-property>
<ex-property>
<name>metadataBidiFormatStr</name>
<value>ILYNN</value>
</ex-property>
</list-property>
<property
name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="8">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<text-property
name="heading">ORDERNUMBER</text-property>
<property name="displayLength">11</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<text-property
name="heading">PRODUCTCODE</text-property>
<property name="displayLength">15</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<text-property
name="heading">QUANTITYORDERED</text-property>
<property name="displayLength">11</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<text-property name="heading">PRICEEACH</text-property>
<property name="displayLength">22</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
<structure>
<property name="columnName">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<text-property
name="heading">ORDERLINENUMBER</text-property>
<property name="displayLength">6</property>
<property name="horizontalAlign">justify</property>
<property name="wordWrap">false</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="dataType">float</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">5</property>
</structure>
</list-property>
<xml-property name="queryText"><![CDATA[select *
from orderdetails
where ordernumber = 10101
]]></xml-property>
<xml-property name="designerValues"><![CDATA[<?xml
version="1.0" encoding="UTF-8"?>
<model:DesignValues
xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRODUCTCODE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRODUCTCODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRODUCTCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>QUANTITYORDERED</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>QUANTITYORDERED</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>QUANTITYORDERED</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRICEEACH</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>PRICEEACH</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>PRICEEACH</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERLINENUMBER</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>5</design:nativeDataTypeCode>
<design:precision>5</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>ORDERLINENUMBER</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>ORDERLINENUMBER</design:label>
<design:formattingHints>
<design:displaySize>6</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
<design:criteria/>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab" id="6">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="NewStyle" id="9">
<property name="backgroundImage">c:/dwn/Koala.jpg</property>
<property name="backgroundRepeat">no-repeat</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table id="49">
<property name="dataSet">Data Set</property>
<list-property name="visibility">
<structure>
<property name="format">all</property>
<expression name="valueExpr"
type="javascript">true</expression>
</structure>
</list-property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<expression name="expression"
type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<column id="78"/>
<column id="79"/>
<column id="80"/>
<column id="81"/>
<column id="82"/>
<header>
<row id="83">
<cell id="84">
<property name="colSpan">5</property>
<property name="rowSpan">1</property>
<label id="89">
<text-property name="text">This table is
hidden an just used to calculate the background image for the grid
below. Look at the on create method of the row.</text-property>
</label>
</cell>
</row>
<row id="50">
<cell id="51">
<label id="52">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="53">
<label id="54">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="55">
<label id="56">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="57">
<label id="58">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="59">
<label id="60">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="61">
<method name="onCreate"><![CDATA[var qty =
this.getRowData().getColumnValue("QUANTITYORDERED");
if( qty > 40 ){
SwapBGI = true;
}]]></method>
<cell id="62">
<data id="63">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="64">
<data id="65">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="66">
<data id="67">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="68">
<data id="69">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="70">
<data id="71">
<property name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="72">
<cell id="73"/>
<cell id="74"/>
<cell id="75"/>
<cell id="76"/>
<cell id="77"/>
</row>
</footer>
</table>
<grid id="10">
<property name="style">NewStyle</property>
<property name="masterPage">Simple MasterPage</property>
<property name="height">10in</property>
<property name="width">100%</property>
<method name="onPrepare"><![CDATA[SwapBGI = false;]]></method>
<method name="onCreate"><![CDATA[if( SwapBGI ){
this.getStyle().backgroundImage="c:/dwn/Jellyfish.jpg";
}
if( !params["showWM"].value ){
this.getStyle().backgroundImage = "";
}]]></method>
<column id="11"/>
<row id="12">
<property name="height">9in</property>
<cell id="13">
<table id="14">
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property
name="name">ORDERNUMBER</property>
<text-property
name="displayName">ORDERNUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERNUMBER"]</expression >
<property
name="dataType">integer</property>
</structure>
<structure>
<property
name="name">PRODUCTCODE</property>
<text-property
name="displayName">PRODUCTCODE</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property
name="name">QUANTITYORDERED</property>
<text-property
name="displayName">QUANTITYORDERED</text-property>
<expression name="expression"
type="javascript">dataSetRow["QUANTITYORDERED"]</expression >
<property
name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<text-property
name="displayName">PRICEEACH</text-property>
<expression name="expression"
type="javascript">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property
name="name">ORDERLINENUMBER</property>
<text-property
name="displayName">ORDERLINENUMBER</text-property>
<expression name="expression"
type="javascript">dataSetRow["ORDERLINENUMBER"]</expression >
<property
name="dataType">integer</property>
</structure>
</list-property>
<column id="43"/>
<column id="44"/>
<column id="45"/>
<column id="46"/>
<column id="47"/>
<header>
<row id="15">
<cell id="16">
<label id="17">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="18">
<label id="19">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="20">
<label id="21">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="22">
<label id="23">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="24">
<label id="25">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="26">
<cell id="27">
<data id="28">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="29">
<data id="30">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="31">
<data id="32">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="33">
<data id="34">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="35">
<data id="36">
<property
name="whiteSpace">nowrap</property>
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="37">
<cell id="38"/>
<cell id="39"/>
<cell id="40"/>
<cell id="41"/>
<cell id="42"/>
</row>
</footer>
</table>
</cell>
</row>
</grid>
</body>
</report>


On 7/29/2010 5:27 AM, pigargo wrote:
> Hallo Jason,
>
> thank you very much. This was a big help for me.
>
> But now I have two problems.
>
> 1) My background image will fill the whole page. Now I have limited the
> data, so that they will fill only the half page. What's happen? The
> background image is printed only for the half page.
>
> 2) If the image is not so big to fill the whole page I will stretch it
> to the size of the grid. So I set the values background size height and
> background size width to contain. The image was contained in preview and
> html, but not in pdf.
>
> I am using birt 2.5.2, will this be a bug?
> pigargo
Re: watermark and company stamp [message #551968 is a reply to message #550220] Tue, 10 August 2010 10:46 Go to previous messageGo to next message
pigargo is currently offline pigargoFriend
Messages: 14
Registered: May 2010
Junior Member
Hallo Jason,

I have tried it and now the image is printing over the whole page.

Thank's for your help.

pigargo
Re: watermark and company stamp [message #552101 is a reply to message #549897] Tue, 10 August 2010 20:24 Go to previous message
John Ward is currently offline John WardFriend
Messages: 16
Registered: July 2009
Junior Member
The answer to all these questions is some scripting.

What I would recommend is that you use a dynamic parameter that is
populated by your dataset. Then, using some event handling scripting,
use something along the following lines in the beforeFactory event to
get the value from your database.

if (params["pImage"] == true)
{
reportContext.getReportRunnable().getDesignInstance().getMas terPage( "myMasterPage").getStyle().backgroundAttachment
= "fixed";
reportContext.getReportRunnable().getDesignInstance().getMas terPage( "myMasterPage").getStyle().backgroundImage=
params["watermark"];
reportContext.getReportRunnable().getDesignInstance().getMas terPage( "myMasterPage").getStyle().backGroundPositionX
= "50%";
reportContext.getReportRunnable().getDesignInstance().getMas terPage( "myMasterPage").getStyle().backGroundPositionY
= "50%";
reportContext.getReportRunnable().getDesignInstance().getMas terPage( "myMasterPage").getStyle().backgroundRepeat
= "no-repeat";
}

Using the dynamic parameter is the only way to get access to data in a
dataset in the generation phase.

John



On 7/28/2010 6:54 AM, pigargo wrote:
> Hallo,
>
> I want to print a watermark and a company stamp on my report.
> For both i can use the background image on the master page. But I don't
> have found any possibility to take an image from the filesystem which is
> defined in a report datasetrow.
> And then I have a problem to set the visibility of the image. There is
> no visibility definition on the background image and also not on the
> master page. But the watermark "copie" only should be printed, if the
> parameter P_ORIGINAL is not set.
>
> Is there any way to solve this problems?
>
> Thanks for your help.
Previous Topic:BIRT XML Tags
Next Topic:Chart Engine API - how to implement zoom
Goto Forum:
  


Current Time: Thu Apr 25 01:57:34 GMT 2024

Powered by FUDForum. Page generated in 0.04953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top