How to bind footnotes in JasperReports - jasper-reports

I have Textfields with dynamic position. It has footnotes, e.g. "some text1". And this footnotes are in the footer.
Footenote must be on the same page with textfield. Textfield has a float position and its location depends from dynamic size of Textfields above. With different conditions the field is located on different pages
How to bind TextField whith footnote in one page, e.g. Textfield is on the page number 3 and footnote on the same page? I can use $V{PAGE_NUMBER}, but how to get current page of TextField?

I have added $P{REPORT_PARAMETERS_MAP}.put("id_1",$V{PAGE_NUMBER})) at the end of textFiled Expression and $V{PAGE_NUMBER}.equals($P{REPORT_PARAMETERS_MAP}.get("id_1")) in the PrintWhenExpression of textField in the footer

Related

Document band Occupying white space when not printed

I need to print a set of information on the bottom of my document's first page (right after detail band). Since the information printed on detail is too large, the document creates a pagination to display the rest of the information, but independent of what I use (Group,ColumnFooter,PageFooter,etc) to print the information tha should be printed on the first page only, this band keeps occupying a white space on consequent pages.
You can create a dummy group that would break with every record, but only while we are on the first page.
Such group would not have a group header or footer, but would use minHeightToStartNewPage with a value that would match the taller page footer required on the first page.
The group expression would look like the following:
$V{PAGE_NUMBER} == 1 ? $V{REPORT_COUNT} : null
This dummy group would cause a page break to occur upper on the first page, leaving more space for a larger page footer.
Now, the second trick is to place content in the page footer section, but at a position having a negative Y coordinate. By doing so, you can keep the height of the page footer section small, while being able to render content above it.
This content having negative Y inside the page footer would be printed conditionally, only on the first page, using the printWhenExpression.

Android tabwidget each tab text

I have tabview like below, I want to change text all caps to:
Purchases
Recharge Amount
and also want to size to text.
How can I do it?
If the fragment is coded correctly, have a look in /res/values/strings.xml. In there should be a list of strings, and you will be able to update their formatting there.
If you can't find them in there, check the fragment itself for the values.
As for text size, in the fragment itself you can add a value to the TextView element (or the element that is holding the header).
android:textSize="16dp"
Adding that will change the size of the font.

How to stretch text field on multiple pages in Jasper Reports?

Scenario:
I have a jasper report with multiple text fields inside a detail band. Each text field has the properties:
Position: Float
Stretch Type: Relative to tallest object
Print When Detail Overflows: False
Stretch With Overflow: True
The details band has the property:
SplitType: Stretch
Current Result:
When one of the text fields is taller than the page and extends to a next page, all other text fields stretch to the end of the page.
Problem:
I want all text fields to be able to stretch on the next page as well. If I use the property 'Print When Detail Overflows: True' then this causes the text fields to be 'reprinted' with data duplicated. That is not my intention. I want to be able to stretch the text field to more than one page.
Thank you!
I also have same problem and after playing whole day did not figure out anything :-(.
My workaround was to set whole band to "Prevent" split type. It is not solution. Only trying to not have text fields 'reprinted' with data duplicated.
You can try setting to the field's Stretch Type to Relative to Band Height. If that didn't work, just play with those properties. I believe you can accomplish it by playing with the properties you mentioned.

How to stretch a text field relative to data width in Jasper Reports

I have a text field followed by a static text field and I am trying to do 2 things with it:
Get the text field to stretch horizontally (not wrap) when text is longer then the field width and
Push the static text field right when the text field to the left of it stretches
Both of the fields are contained within a frame.
I have both fields set to positionType=float and the text field set to stretchWithOverflow=true, which enable text to wrap vertically but not stretch horizontally.
Is it possible to achieve 1 and 2 above? If so How?
Instead of having 2 text fields (dynamic and static), you can have 1 text field with value as $F{Field} + "statix text". This will probably fix your issue. Also, you can set the "width" and "stretch with overflow" properties, as per your requirements.
Well it's bad news!! According to Jaspersoft's documentation on stretching fields it is not possible to stretch the width of a field:
"Usually, the stretching process refers to the height adjustment only.
When stretching report elements, adjusting the width could affect also
the page width and raise unexpected errors at runtime (for instance,
truncated information could be printed out on pages). This is why
stretching an element let its width unchanged, while its height gets
definitely enlarged in order to make room for all information that
have to be displayed." (Jaspersoft documentation [v4.5.0], 2011)
However a solution to the original issue can be found here thanks to #mdahlman
Just select text field and from its textfield properties choose "stretch with overflow" and it will change its height dynamically according to text .enter image description here

JasperReports, PrintWhenExpression and RemoveLineWhenBlank → Strange Behaviour

I have a problem with JasperReports when using printWhenExpression and RemoveWhenBlank inside a subreport.
To reproduce this problem, I made a simple example using one master report and two subreport.
The first subreport, let's call it the static subreport, contains two Static Text components in the title band (Label 1 on the first line, Label 3 on the second), both have the Position Type attribute set to Float. The title band Split Type attribute is set to "Immediate".
The dynamic subreport have three Static text components (Label 1 on the 1st line, Label 2 on the second and Label 3 on the third), all of them have the Position Type set to Float. But Label 2 has PrintWhenExpression set to Boolean.FALSE and RemoveLineWhenBlank set to TRUE. So Label 2 is hidden and Label 3 is moved to Label 2's place under Label 1.
So basically the dynamic subreport and the static one have the same structure and should behave the same way when printed inside a report. But that's not the case in this little example.
In the master report I'm using a subreport component inside the detail band ( the split type of the detail band is set to Immediate ) and using a JREmptyDataSource with 90 empty rows. When pointing the subreport component to the static subreport, the pdf output generated by jasperreports is corrrect. But when using the dynamic subreport, jasperreports leaves an empty space (that is used when using the static subreport) at the end of the first page and jumps to the next page to print Label 3.
In the real case that I have a problem with, I have a subreport that contains more than 20 lines with Static Text and Text Field components, most to them with printWhenExpression set to a field or a parameter and RemoveLineWhenBlank set to TRUE. When producing the pdf output in some cases I have that specific subreport (which should occupy just  a third of a page) spanning one page and a half with a lot of space spread between the visible lines in the subreport. And I think the combination of RemoveLineWenBlank and PrintWhenExpression is what's causing the problem.
 
So what I want know is if this is a bug or just me missing something in the documentation.
Here is a link to the post I made at the JasperReports forum, it contains the templates for the master report and the two subreports, plus two pdfs generated by jasperreports and screenshots showing the layout of the subreports: link
Thanks in advance for your help.