Setting Table Run direction in BIRT 2.2 [message #259940] |
Tue, 30 October 2007 08:09  |
Eclipse User |
|
|
|
Originally posted by: bpraveena2002.gmail.com
Hi All,
I'm trying to create a pdf using BIRT 2.2 where the tables run direction
will change based on the locale used
For eg, When the Locale is english the table would look like
Column1 Column2 Column3
Row1-1 Row1-2 Row1-3
Row2-1 Row2-2 Row2-3
When the locale is Arabic the table should appear like
Column3 Column2 Column1
Row1-3 Row1-2 Row1-1
Row2-3 Row2-2 Row2-1
Where the entire table has been transposed. It is possible to achive this
in itext by setting
the rundirection property of the PdfPTable.
Is it possible to achive this through configuration settings in BIRT.
Or is there any other way to achive this through code modification?
Thanks and Regards,
Praveena
|
|
|
Re: Setting Table Run direction in BIRT 2.2 [message #259956 is a reply to message #259940] |
Tue, 30 October 2007 11:42  |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Praveena,
I know this is handled in the HTML by using the RTL flag in the url, but
I do not see this handled in the pdftable. You can call the deapi from
script and modify the table on the fly based on locale. Attached is an
example. Can you log an enhancement request to get the rtl flag put on
the rundirection for the the pdf table?
Jason
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.14"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.2.0.v20070620 Build <2.2.0.v20070626-1003></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2007 <<Your Company
Name here>></property>
<html-property name="description">Creates a blank report with no
predefined content.</html-property>
<method name="beforeFactory"><![CDATA[importPackage(
Packages.org.eclipse.birt.report.model.api );
mylocale = reportContext.getLocale().toString();
if( mylocale == "ar"){
mytable =
reportContext.getReportRunnable().designHandle.getDesignHand le().findElement( "mytable");
tabledetail = mytable.getDetail( ).get( 0 );
tableheader = mytable.getHeader( ).get( 0 );
hcell1 = tableheader.getCells( ).get( 0 );
hcell2 = tableheader.getCells( ).get( 1 );
hcell4 = tableheader.getCells( ).get( 3 );
hcell5 = tableheader.getCells( ).get( 4 );
hdata1 = hcell1.getContent( ).get(0);
hdata2 = hcell2.getContent( ).get(0);
hdata4 = hcell4.getContent( ).get(0);
hdata5 = hcell5.getContent( ).get(0);
hcell1.getContent( ).drop(hdata1);
hcell1.getContent( ).add(hdata5);
hcell2.getContent( ).drop(hdata2);
hcell2.getContent( ).add(hdata4);
hcell4.getContent( ).drop(hdata4);
hcell4.getContent( ).add(hdata2);
hcell5.getContent( ).drop(hdata5);
hcell5.getContent( ).add(hdata1);
cell1 = tabledetail.getCells( ).get( 0 );
cell2 = tabledetail.getCells( ).get( 1 );
cell4 = tabledetail.getCells( ).get( 3 );
cell5 = tabledetail.getCells( ).get( 4 );
data1 = cell1.getContent( ).get(0);
data2 = cell2.getContent( ).get(0);
data4 = cell4.getContent( ).get(0);
data5 = cell5.getContent( ).get(0);
cell1.getContent( ).drop(data1);
cell1.getContent( ).add(data5);
cell2.getContent( ).drop(data2);
cell2.getContent( ).add(data4);
cell4.getContent( ).drop(data4);
cell4.getContent( ).add(data2);
cell5.getContent( ).drop(data5);
cell5.getContent( ).add(data1);
}]]></method>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="6">
<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="7">
<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>
<property name="queryText">select *
from orderdetails
</property>
</oda-data-set>
</data-sets>
<styles>
<style name="crosstab" id="4">
<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-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>
</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>
<data id="43">
<list-property name="boundDataColumns">
<structure>
<property name="name">Column Binding</property>
<expression name="expression">mylocale</expression>
<property name="dataType">any</property>
</structure>
</list-property>
<property name="resultSetColumn">Column Binding</property>
</data>
<table name="mytable" id="8">
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<expression
name="expression">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<expression
name="expression">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<expression
name="expression">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<expression
name="expression">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<expression
name="expression">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<column id="37"/>
<column id="38"/>
<column id="39"/>
<column id="40"/>
<column id="41"/>
<header>
<row id="9">
<cell id="10">
<label id="11">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="12">
<label id="13">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="14">
<label id="15">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="16">
<label id="17">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="18">
<label id="19">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="20">
<cell id="21">
<data id="22">
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="23">
<data id="24">
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="25">
<data id="26">
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="27">
<data id="28">
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="29">
<data id="30">
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="31">
<cell id="32"/>
<cell id="33"/>
<cell id="34"/>
<cell id="35"/>
<cell id="36"/>
</row>
</footer>
</table>
</body>
</report>
Praveena Babu wrote:
> Hi All, I'm trying to create a pdf using BIRT 2.2 where the tables
> run direction will change based on the locale used
>
> For eg, When the Locale is english the table would look like
>
> Column1 Column2 Column3
> Row1-1 Row1-2 Row1-3
> Row2-1 Row2-2 Row2-3
>
> When the locale is Arabic the table should appear like
>
> Column3 Column2 Column1
> Row1-3 Row1-2 Row1-1
> Row2-3 Row2-2 Row2-1
>
> Where the entire table has been transposed. It is possible to achive
> this in itext by setting the rundirection property of the PdfPTable.
>
>
> Is it possible to achive this through configuration settings in BIRT. Or
> is there any other way to achive this through code modification?
>
>
> Thanks and Regards,
> Praveena
>
|
|
|
Powered by
FUDForum. Page generated in 0.02415 seconds