Jump to content
We've recently updated our Privacy Statement, available here ×

XLS format creates extra row if large value


dtrobert

Recommended Posts

Hi,

I have a report that produces a standard XLS output. It works well except when the value in the cell exceeds that defined by the width. In that case, the report ends up creating extra rows beneath the large cell. Is there a setting to either expand the field width to adjust automatically to the largest value (i.e. auto-fit column) or truncate it?

 

Thanks

Link to comment
Share on other sites

  • Replies 12
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

There is no way the text field would adapt its width to accommodate the text. It can adapt only its height.

If you are OK with truncating text, then you just need to set isStretchWithOverflow="false" for your text field.

 

But if you are actually bothered by the fact that the field which expands sticks out of the crowd, and you would rather see all the row expand in height, then you need to put all the elements on that row in a <frame> and set stretchType="RelativeToBandHeight" for all of them.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the info,

I have isStretchWithOverflow="true" and stretchType="RelativeToTallestObject" . The problem isn't the text hanging over because it's wrapping. The problem is that I'm seeing extra blank columns added after columns where the values_maxwidth > field_maxwidth. I'm not really sure why it's happening or if it should.

 

One thing is that I'm using columns and column width=100. However, I've had to override some columns to be larger than 100--not sure if that might be causing the problem.

Link to comment
Share on other sites

Here's an excerpt from the report...

 

<jasperReport

name="MyReport"

columnCount="1"

printOrder="Vertical"

orientation="Landscape"

pageWidth="6600"

pageHeight="30"

columnWidth="6600"

columnSpacing="0"

leftMargin="0"

 

----------cut-----------------------------

 

<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="700"

y="0"

width="100"

height="15"

key="Description"

stretchType="RelativeToTallestObject"/>

<box topBorder="Thin" topBorderColor="#000000" leftBorder="Thin" leftBorderColor="#000000" rightBorder="Thin" rightBorderColor="#000000" bottomBorder="Thin" bottomBorderColor="#000000"/>

<textElement>

<font reportFont="Verdana_Bold" pdfFontName="Helvetica"/>

</textElement>

<textFieldExpression class="java.lang.String"><![CDATA["Description"]]></textFieldExpression>

</textField>

Link to comment
Share on other sites

  • 2 weeks later...

Changed the 'isStretchWithOverflow="false" (was true) for both column header and detail sections but no difference. Attaching what I mean by extra column. size=294]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/extracolumn.GIF

 

Thanks

Link to comment
Share on other sites

Okay, very confused now but getting closer.

 

1. I reduce the number of columns to end with the first column showing this behavior.

 

2. I switched data in the columns, copied formatting from other columns, etc. The result being that now, the last column of the report has this extra 'tiny column'.

 

I then played with column count, page width but nothing helped. It's not the data in the column since switching it works fine (column looks good in new location). There's nothing different about the column definition itself (textField stuff). It almost seems like a weird bug but I can't even give a reason for it to occur.

Link to comment
Share on other sites

Hi,

 

I think this if because of the alignment of field/text element in the report.

 

For an example, you have a text in header with X=50 Y=20 with the element width=100

In the details section you have a field in same position (X=50 Y=20) but the width is 110. This will cause the column in header to be merge to follow details section's.

 

2nd situation will be the position of element is not in same axis. In header, X=50 Y=20 but in details, X=51 Y=20

Link to comment
Share on other sites

Thanks, I figured out the extra column problem with your suggestions. It turned out that my subreport width parameter was much less than the report pageWidth. When I made them the same, the column disappeared.

 

I'm still having a problem with an extra cell created below the value when a neighboring column wraps. It's easier to explain if you look at the image. I know I can truncate the value in the other cell but isn't there a way to allow the first column (see example) to stretch and be the same height? I should also mention that in this particular example, the first row is itself a subreport below that of the other columns.

size=294]http://www.jasperforge.org/components/com_joomlaboard/uploaded/images/extrarow.GIF

Post edited by: dtrobert, at: 2007/05/15 21:23

Link to comment
Share on other sites

What you suggest makes sense but I'm still not having much luck.

 

I only have the splitting problem for the 2 columns that are called via additional subreports.

 

There are essentially 4 reports in all

 

rp1 (shows column headers, and calls subreport for rp2)

rp2 (has details for all columns except 2, calls 2 subreports [rp3a,rp3b] to supply values for 2 columns)

rp3a

rp3b

 

so in rp3a,rp3b I have

-split not allowed on band

-'Relative to band height' for the one textfield' (one textfield per report)

 

in rp2, I have

-split not allowed on band

-the subreport calls have 'Relative to band height' for the 2 columns

 

What am I missing?

Thanks

Link to comment
Share on other sites

  • 1 year later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...