on 12-12-2006 6:43 PM
<p>we are trying to make a crystal report for both english and arabic..All the arabic data is stored in data base tables.And for arabic screens we need tables and datas come right to left.. </p><p>1)How can we get the arabic data and right to left alignment in crystal reports? </p><p>2)Is thee any direct method to change the report alignments? </p><p>can u please send some sample codes. </p><p>we are using java version= 1.5 </p><p>database using =Oracle 9i </p><p>char set we are using for arabic= CP1256</p><p> Tomcat using=4.1 </p><p>we are using Crystal Reports11 </p><p>We are not having seperate rpt files for reports. we are making each Sections and adding this sections to FieldObjet to make the report dynamically. A sample Employee report in english is attached..Can u instruct how can i get this report in arabic assuming all datas are stored in database. </p><p><br />import java.awt.BorderLayout;<br />import javax.swing.JFrame;<br />import com.crystaldecisions.ReportViewer.ReportViewerBean;<br />import com.crystaldecisions.sdk.framework.CrystalEnterprise;<br />import com.crystaldecisions.sdk.framework.IEnterpriseSession;<br />import com.crystaldecisions.sdk.occa.managedreports.IReportAppFactory;<br />import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;<br />import com.crystaldecisions.sdk.occa.report.data.;<br />import com.crystaldecisions.sdk.occa.report.definition.;<br />import com.crystaldecisions.sdk.occa.report.lib.PropertyBag;<br />import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;<br />import com.crystaldecisions.sdk.occa.report.reportsource.IReportSource;<br />public class ReportSample {<br /> ReportClientDocument rptDoc=null;<br /> int fldTop=0;<br /> int fldWidth=1440;<br /> int fldHeight=400;<br /> int pageWidth=11500;<br /> ReportSample(){<br /> try{<br /> IEnterpriseSession oEnterpriseSession= CrystalEnterprise.getSessionMgr().logon("Administrator", "","zzzza","secEnterprise");<br /> IReportAppFactory oReportAppFactory = (IReportAppFactory)oEnterpriseSession.getService("", "RASReportService");<br /> rptDoc = oReportAppFactory.newDocument(java.util.Locale.ENGLISH);<br /> Table oTable = new Table();<br /> oTable.setConnectionInfo(getConnectionInfo("zzzzz","zzzz","zzz", "zzz"));//Connectin to oracle database<br /> oTable.setName("EMP1");<br /> rptDoc.getDatabaseController().addTable(oTable, null);<br /> String[] columnName={"EMPNAME"};<br /> Section dtlSection=(Section) rptDoc.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0);<br /> int fldLeft=100;<br /> for (int i=0;i<columnName.length;i+)<br /> {<br /> <br /> dtlSection= (Section) rptDoc.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0);<br /> try{<br /> FieldValueType fldValueType = FieldValueType.stringField;<br /> String javaDataType="String";<br /> add_db_field(<br /> dtlSection, <br /> oTable.getName()"."columnName<i>, <br /> fldValueType,javaDataType,<br /> fldLeft, fldTop, fldWidth, fldHeight);<br /> }catch(Exception e){<br /> e.printStackTrace();<br /> }<br /> fldLeft = fldLeftfldWidth;<br /> }<br /> <br /> <br /> try { <br /> //Create and set up the window.<br /> JFrame frame = new JFrame("ReportsViewer");<br /> frame.setTitle( "Crystal Reports Viewer");<br /> frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);<br /> ReportViewerBean viewer = new ReportViewerBean();<br /> viewer.init( new String[0], null, null, null);<br /> IReportSource rptSource = rptDoc.getReportSource();<br /> viewer.setReportSource( rptSource );<br /> frame.getContentPane().add( viewer, BorderLayout.CENTER );<br /> frame.setSize( 700, 500 );<br /> frame.setVisible(true);<br /> viewer.start();<br /> }catch(Exception e)<br /> {<br /> e.printStackTrace();<br /> }</p><p> }catch(Exception e)<br /> {<br /> e.printStackTrace();<br /> }<br /> }<br /> public ReportObject add_db_field(Section oSection, String field_name, <br /> FieldValueType oFieldValueType,String fldDataType,<br /> double x, double y, double w, double h)<br /> throws ReportSDKException<br /> {<br /> DBField oDBField = new DBField();<br /> oDBField.setName(field_name);<br /> oDBField.setType(oFieldValueType);<br /> FieldObject oFieldObject = new FieldObject();<br /> oFieldObject.setDataSource(oDBField.getFormulaForm());<br /> oFieldObject.setFieldValueType(oDBField.getType());<br /> IndentAndSpacingFormat indentSpacing = new IndentAndSpacingFormat();<br /> IStringFieldFormat stringFieldFormat = oFieldObject.getFieldFormat().getStringFormat();<br /> stringFieldFormat.setIndentAndSpacingFormat(indentSpacing);<br /> oFieldObject.getFieldFormat().setStringFormat(stringFieldFormat);<br /> rptDoc.getReportDefController().getReportObjectController().add(oFieldObject, oSection, -1);<br /> return oFieldObject;<br /> }<br /> public ConnectionInfo getConnectionInfo (String new_username, String new_password, String new_dsn, String new_database)<br /> {<br /> <br /> ConnectionInfo oConnectionInfo = new ConnectionInfo(); // Make a copy, don't change the original.<br /> PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();<br /> oPropertyBag1.put("QE_ServerDescription", new_database);<br /> oPropertyBag1.put("Database DLL", "crdb_oracle.dll" );<br /> oPropertyBag1.put("DSN", new_dsn);<br /> // Set new table logon properties attributes<br /> PropertyBag oPropertyBag2 = new PropertyBag();<br /> oPropertyBag2.put("Server", new_database);<br /> oPropertyBag1.put("QE_LogonProperties", oPropertyBag2);<br /> oConnectionInfo.setAttributes(oPropertyBag1);<br /> oConnectionInfo.setUserName(new_username);<br /> oConnectionInfo.setPassword(new_password);<br /> // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).<br /> oConnectionInfo.setKind(ConnectionInfoKind.CRQE);<br /> return oConnectionInfo;</p><p> }<br /> public static void main(String[] args) {<br /> // TODO Auto-generated method stub<br /> new ReportSample();<br /> //String cmsName = "admin-42cdvir7e(2)";<br /> <br /> <br /> <br /> }<br /> </p><p>}<br /></p>
<p>This issue can be solved when you create the reports without needing to write any extra code. I haven't tested this solution because I don't have any data to test it against.</p><p>First you want to make sure that you are using a UNICODE font which I'm sure you are probably already doing. Then to configure the "Right to Left" you can right click on any field and select "Format Text" or "Format Field". You should see a "Paragraph" tab. In there you can set the content to be "Left to Right" or "Right to Left". The button on the right allows you to make this setting conditional on a parameter value or something like that. I hope this helps. </p><p>Rob Horne<br /><a href="/blog/10">Rob's blog - http://diamond.businessobjects.com/blog/10</a></p>;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<p>Thanx for your prompt reply.</p><p>We are not using UNICODE; our arabic char set is CP1256 (single byte unlike 2bytes representation of UNICODE).</p><p>Also, all the reports we are generating using the sample program that I have posted (i.e. user selects report type, columns, order by, where clause etc..) based on this we are generating reports. We are not designing reports using designer. </p>
<p>I'm not sure how you will accomplish this without UNICODE, but I don't have any experience with this language. As for setting the text to "right to left", you should be able to set this property on the field using the RAS SDK - Paragraph.setReadingOrder(...);</p><p>Hopefully this should help. </p><p>Rob Horne<br /><a href="/blog/10">Rob's blog - http://diamond.businessobjects.com/blog/10</a></p>;
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.