Vertical line in detail section

Hi, is there a way to have a vertical line in detail section to separate the columns?

I have some columns without content and I want to create a vertical line to separate these columns.



The vertical line in background section is not good option because in some page the content don´t fill all the document.

Any coments. Thanks.
Post edited by: Ajenjo, at: 2008/03/14 14:04

Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago

14 Answers:

When i understand right, you want to have all you column-details filled

e.g. if 3 column layout but just 4 records that the line after "virtual" 5th and 6th record also comes like this!?

Detail1 | Detail2 | Detail3 |
Detail4 | _______ | _______ |

I guess (not sure) you should add 2 empty records in this case to your datasource.

just my idea... perhaps anyone has another one!??!

C-Box
C-Box's picture
24103
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 month 2 days ago
Thanks but it's not good solution for me because the registers have diferent height (the atribute isStretchWithOverflow is TRUE).

(Sorry but I can´t update a image with an example)

Any idea?
Post edited by: Ajenjo, at: 2008/03/14 17:13
Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Don't understand... the vertical lines should have StretchType = RelativeToBandHeight... so it's either how long your text stretches?!?!?

Just add a ZIP file with the image inside, if it's too large for direct attachment.

C-Box
C-Box's picture
24103
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 month 2 days ago

For example, I have four colums but only in one I draw the content, this cell have variable height (isStretchWithOverflow is TRUE) depending of the words that have.

One solution is draw a background color for know what column belong to each field. But it's not good idea because the cell that don´t have content not draw all height of the register because it only have one line. In the attach file you can see better what I am trying to explain (the image is doing with Paint because I haven´t got the real document in this computer, but I hope you understand)

There are other posibilities to do this??? I can have a vertical line whose height variate depending of the content of the field description to separe the fields???

[file name=img.zip size=4019]

Thanks and excuse me for my english.

Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Hmm I think I will understand your problem slowly....

You spoke from Columns... be aware to mix up multiple Columns design with just a simple report with fields side by side... (what is just a one column design in JasperReports world)

as I told you already before... make the other fields/vertical lines "StretchType = RelativeToBandHeight" and you will get your price field or vertical line as high as the selfstretching description field.

Just give it a try - it will work! (otherwise post your jrxml and I will set the needed attributes)
C-Box
C-Box's picture
24103
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 month 2 days ago

Thanks so much.

But I have a new problem :(

I have a to separate the cells, but there are some registers cut in the final of the page, and when continue the content in the next page, the lines in the cells that don´t have content not appears.

There are any solutions for this?? I can do that the registers don´t cut (when page finish) to allways appears without the text cut??

The attach file is the example.

[file name=example-adc955697bc2c264c9287b612da80ace.zip size=24404]

Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Well I could imagine, that you should set the attribute "PrintRepeatedValues" of your box to true.. so the box is also printed at next page.

just try! :-)

C-Box
C-Box's picture
24103
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 month 2 days ago

I don´t find the atribute "PrintRepeatedValues" in box I just find it in reportElement as isPrintRepeatedValues but don´t work correctly.

My code is :

Code:
(...)
<detail>
    <band height="15">
        <textfield hyperlinktype="None">
            <reportelement height="13" isprintrepeatedvalues="true" stretchtype="RelativeToBandHeight" width="35" x="0" y="0"></reportelement>
            <box>
                <leftpen linecolor="#000000" linestyle="Solid" linewidth="1.0"></leftpen>
                <rightpen linecolor="#000000" linestyle="Solid" linewidth="1.0"></rightpen>
            </box>
            <textelement textalignment="Center">
 
            </textelement>
            <textfieldexpression class="java.lang.String">
                <!--[CDATA[$F{codigo}]]-->
            </textfieldexpression>
        </textfield>
        <textfield hyperlinktype="None" isstretchwithoverflow="true">
            <reportelement height="13" isprintrepeatedvalues="true" stretchtype="RelativeToBandHeight" width="170" x="35" y="0">
            </reportelement>
            <box>
                <leftpen linecolor="#000000" linestyle="Solid" linewidth="1.0"></leftpen>
                <rightpen linecolor="#000000" linestyle="Solid" linewidth="1.0"></rightpen>
            </box>
            <textelement>
 
            </textelement>
            <textfieldexpression class="java.lang.String">
                <!--[CDATA[$F{descripcion}]]-->
            </textfieldexpression>
        </textfield>
            (...)
</band></detail>
(...)
Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Can you help me with this?

Please
Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Ups... forgot to answer yesterday - sorry!

Well I thought, you would use rectangles for your so called "box".. but you used the borders of the textfields...

so just remove the borders of the textfields and use simple vertical lines instead (place them between your fields) that have the Attribute "PrintRepeatedValues=true" and "StretchType = RelativeToBandHeight".

Then - I hope/think - it will work! :-)

hth
C-Box
C-Box's picture
24103
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 month 2 days ago

Thanks CBox.

I have one line as you told me ...
 

Code:
(...)
<detail>
    <band height="15">
        <line>
            <reportElement isPrintRepeatedValues="true" stretchType="RelativeToBandHeight"
                           x="0" y="0" width="1" height="13"></reportElement>
        </line>
        <textField hyperlinkType="None">
	    <reportElement stretchType="RelativeToBandHeight" x="1" y="0" width="34" height="13"></reportElement>
	    <textElement textAlignment="Center">
                <font isStrikeThrough="false"></font>
            </textElement>
            <textFieldExpression class="java.lang.String">
                <![CDATA[$F{codigo}]]>
            </textFieldExpression>
        </textField>
(...)

... but I have the same problem, when the description continues in the next page, the line don´t print.

I think it happends because the field don´t have text and then it don´t print in the next page.

Maybe I don´t make the code correctly.

Thanks again.

Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Hmmm strange, I thought this would do the trick....as the lines should stretch to the corresponding band height, that is drawn also at next page.

Have you already tried the "RelativeToTallestObject" Attribute (as in my opionion the TextField is the tallestObject)???

Otherwise it becomes tricky....
next I would try to place all the elements inside a frame (so textfields + lines) just to check if the lines are now repeated at next page.

Otherwise the only thing I could imagine that could work is to use a "DummySubReport" that has this field in detail and the line in Background but is just as high as your detail is now. Quite ugly but then it must work, as the subreport stretches over the pages and the background is painted at all pages.

Or perhaps anybody else has some ideas?!?

hth
C-Box
C-Box's picture
24103
Joined: Jul 19 2006 - 5:58pm
Last seen: 1 month 2 days ago
Thanks CBox

I have try the "RelativeToTallestObject" attribute but it do the same...

I use <frame> but don´t work. :(

Code:
<br />
(...)<br />
<detail><br />
		<band height="15"><br />
<frame><br />
				<reportElement x="0" y="0" isPrintRepeatedValues="true" stretchType="RelativeToTallestObject" width="782" height="13"/><br />
                                <line><br />
                                        <reportElement isPrintRepeatedValues="true" stretchType="RelativeToTallestObject" x="0" y="0" width="1" height="13"/><br />
                                </line><br />
                                <textField hyperlinkType="None"><br />
                                        <reportElement stretchType="RelativeToBandHeight" x="1" y="0" width="34" height="13"/><br />
                                        <textElement textAlignment="Center"><br />
                                                <font isStrikeThrough="false"/><br />
                                        </textElement><br />
                                        <textFieldExpression class="java.lang.String"><![CDATA[$F{codigo}]]></textFieldExpression><br />
                                </textField><br />
                                <textField isStretchWithOverflow="true" hyperlinkType="None"><br />
                                        <reportElement stretchType="RelativeToBandHeight" x="35" y="0" width="170" height="13"/><br />
                                        <textElement><br />
                                                <font isStrikeThrough="false"/><br />
                                        </textElement><br />
                                        <textFieldExpression class="java.lang.String"><![CDATA[$F{descripcion}]]></textFieldExpression><br />
                                </textField><br />
                                <textField isBlankWhenNull="true" hyperlinkType="None"><br />
                                        <reportElement stretchType="RelativeToBandHeight" x="205" y="0" width="42" height="13"/><br />
                                        <box><br />
                                            <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/><br />
                                            <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/><br />
                                        </box><br />
                                        <textElement textAlignment="Center"/><br />
                                        <textFieldExpression class="java.lang.String"><![CDATA[]]></textFieldExpression><br />
                                </textField><br />
<br />
			</frame><br />
			<line direction="BottomUp"><br />
				<reportElement positionType="FixRelativeToBottom" x="0" y="14" width="782" height="1"/><br />
			</line><br />
		</band><br />
	</detail><br />
(...)<br />
</td></tr></tbody></table><br />
<br />
I thinnk put the lines in background, but if in a page the registers have a few rows, the lines would appear after tese lines where aren't content. <br />
<br />
There is the posibility to print lines without being cut in the final of the page?<br />
<br />
Post edited by: Ajenjo, at: 2008/03/19 11:16<br>Post edited by: Ajenjo, at: 2008/03/19 12:53
Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Ok.

[url=http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func... is the solution.
Post edited by: Ajenjo, at: 2008/03/24 12:01
Ajenjo's picture
884
Joined: Mar 13 2008 - 11:50pm
Last seen: 10 years 9 months ago
Feedback
randomness