Ajenjo Posted January 26, 2012 Share Posted January 26, 2012 Hi.I need your help. I have to create a report of general conditions with two columns for page, like page 2 in http://ec.europa.eu/europeaid/work/framework-contract/enpi/documents/3_2_general_conditions_en.pdfI see the HorizontalReport example, but in my case some text has a bold, italic or underline style...I'm thinking create a report with printOrder="Horizontal" with one line in detail section (for example with the filed 'text') with a 50% of page width and use differents <textField> for each styles: <textField> <reportElement x="40" y="2" width="130" height="11"> <printWhenExpression><![CDATA[new Boolean($F{style}.intValue() == 0)]]></printWhenExpression> </reportElement> <textElement/> <textFieldExpression class="java.lang.Integer"><![CDATA[$F{text}]]></textFieldExpression> </textField> <textField> <reportElement x="40" y="2" width="130" height="11" style="Arial_Bold"> <printWhenExpression><![CDATA[new Boolean($F{OrderID}.intValue() == 1)]]></printWhenExpression> </reportElement> <textFieldExpression class="java.lang.Integer"><![CDATA[$F{text}]]></textFieldExpression> </textField> (...) What you say???Thanks Post Edited by Ajenjo at 01/26/2012 15:20Post Edited by Ajenjo at 01/26/2012 15:25Post Edited by Ajenjo at 01/26/2012 15:27 Link to comment Share on other sites More sharing options...
Ajenjo Posted February 21, 2012 Author Share Posted February 21, 2012 Ok, I read in Strech sample the next:When filling report templates horizontally, dynamic text fields inside the detail section do not stretch to their entire text content, because this might cause misalignment on the horizontal axis of subsequent detail sections. The detail band actually behaves the same as the page and column footers, preserving its declared height when horizontal filling is used.Are some form to print in two columns with large fields in detail section ????????Thanks. Link to comment Share on other sites More sharing options...
mennei Posted February 21, 2012 Share Posted February 21, 2012 Hi,Have you notice the build - in two colunms support?in iReport IDE, you get it when you chose the report in the report inspector, and you have the report properties window. In that window you have colunms section. Here you can configure 2 colunms report.This is the relevant documetion from iReport guide (page 50 - 51)"4.1.2 ColumnsAs we have seen (4.1, “Bands,” on page 45), a report is divided into horizontal sections, that is, bands.The page, which comprises the report, presents portions which are independent of the records coming from the data source(such as the title section, or the page footers), as well as other sections that are driven by those records (such as the groupheaders/footers and the detail). These last portions can be divided into vertical columns in order to optimize the availablespace.Figure 4-3 Page Format dialogIn this context, the concept of “column” can be easily confused with that of “field”. A column is not connected to arecord field; we are just defining the layout of the page, not a table or something tied to the format of the data to print.This means that if you want to print records having, for instance, ten fields, and you want to create a report that lookslike a table, you don’t need ten report columns, but you’ll have to place the report elements (labels and textfields) in asingle column report in order to get the table effect.Use columns when you need a layout similar to that of newspapers, where the text rows are presented on severalcolumns to improve readability and make better use of the space on the page.In the following figures we present two examples. The first shows how to set up a report to use a single column (actually, thisis the default and most common configuration; in this particular case the size of the page is a regular A4).The values are set in the Report Properties view. The number of columns is 1 and the width is equal to the entire page width,except for the margins (that’s 535 pixels). Since there is just a single column, the space between columns is not meaningfuland it is set to zero (this property is actually disabled when the column number is 1).Figure 4-4 Report objects in the outline viewFigure 4-5 Layout of a single column report showing a set of namesAs you can see in Figure 4-6, most of the page is not used (the figure shows only the first page, but the report is composed ofother pages that look very similar); in fact, each record takes the whole horizontal width of the page. So the idea here is to splitthe pages in two columns, so that when the first column reaches the end of the page, we can start to print in this page again in the second column. Figure 4-7 shows the values used for a two-column report.In this case, the columns number property is set to 2. iReport will automatically calculate the maximum column widthaccording to the margins and page width. If you want to increase the space between the columns, just increase the value of the Column Space property.Multiple columns are commonly used for prints of very long lists (for example, the telephone book). The sum of the margins,column widths and every space between columns, has to be less than or equal to the page width. If this condition is notverified, the compilation can result in error.When working with more than one column, you should put elements (fields, images, etc.) inside the first column only. Theother columns are displayed in the designer just for reference, but any element placed here at design time would be treated aspart of the first column (in fact, you are just defining a detail template, so there are no restrictions about placing elementsoutside the horizontal band’s bounds, but it would be like putting elements outside the page)." Sorry about the long answer, but I think this is what you need. Let me know if I wrong.Also, about the differant styles, you can create differants style conditions that apply as your business logic need. Link to comment Share on other sites More sharing options...
Ajenjo Posted February 22, 2012 Author Share Posted February 22, 2012 Thanks for your reply mennei.I'll create my report with these two columns and told you the result.Cheers Link to comment Share on other sites More sharing options...
Ajenjo Posted February 23, 2012 Author Share Posted February 23, 2012 Perfect !!!!!That's the solution.Thanks so much again. Link to comment Share on other sites More sharing options...
Ajenjo Posted January 3, 2013 Author Share Posted January 3, 2013 Hi.The solution is the report property columnCount.In this case: columnCount="2". (By default, the reporting engine creates report with one column on each page.)JasperReports allows creating reports with more than one column on each page, like in the following picture, where we can see the layout of a report with two columns. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now