Jump to content
JasperReports Library 7.0 is now available ×

Excel cell and text overflow


schrepfler

Recommended Posts

On exporting my data in a excel cell, if the text is too long it gets split in another row which is a complete nonsense as it's giving the exported data a whole new meaning. My combinations of exporting the cell and setting properties on the field left me with either not writing the full output because of no space or writing it in a next line. What's the correct way to print the data into the cell even if it's not visible in it's printable form?

Post edited by: schrepfler, at: 2006/08/10 02:43

Link to comment
Share on other sites

  • Replies 16
  • Created
  • Last Reply

Top Posters In This Topic

Hi Teodor,

I'm attaching the xml file, the pdf and excel files (one pair normal and the other with "Strech with overflow" on the street column.)

 

the query is something like this but I've hardcoded the values in order to leave out parameters.

 

SELECT * FROM ELEVATORS AS E JOIN (SELECT B.ELEVATOR, COUNT(B.ID) FROM BREAKDOWNS AS B WHERE INSERTDATE BETWEEN 20040101 AND 20070101 GROUP BY B.ELEVATOR) AS TEMP ON E.ID = TEMP.ELEVATOR WHERE E.SOCIETY=1 AND COUNT > 1 ORDER BY COUNT DESC;

 

As you can see between the reports the one without the overflow clearly lacks parts of the string (VIA CAPO DI instead of VIA CAPO DI LUCCA, and PIAZZA DI PORTA instead of PIAZZA DI PORTA S.DONATO), I'm referring to the excel versions.

What should I do in order to have the string not overflow to the next row? I don't mind if the text is invisible because of the column width as the user can expand it in excel but putting the same data on another row is not correct.

Thanks in advance

attached files below

[file name=ascensorimalati.zip size=9927]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/ascensorimalati.zip[/file]

Link to comment
Share on other sites

Anyone?

Also, second problem I've encountered is this. I've tried to insert multiple fields in an element by doing:

$F{street} + ", " + $F{model} + ", " + $F{brand}

the expression prints correctly in pdf but doesn't print anything in excel.

Is it just me or is the excel support seriously broken?

Link to comment
Share on other sites

You cannot just hide the text, since the text length is calculated at fill time. The excel export is just an approximation of the actual report. The fact that an excel cell can hold a text larger that it can display is just a coincidence, the Jasper engine will always cut off text to fit in its allocated space on the report design (or expand it to the next line).
Link to comment
Share on other sites

Is there some parameter that would override this kind of behaviour? I understand jasper was architected for print but I feel this is a great bug, especially if jasper wants to target more formats that pdf. Also, what about the expression, how come it doesn't print anything under excel and under pdf it prints ok?
Link to comment
Share on other sites

  • 4 weeks later...

ionutned wrote:

You cannot just hide the text, since the text length is calculated at fill time. The excel export is just an approximation of the actual report. The fact that an excel cell can hold a text larger that it can display is just a coincidence, the Jasper engine will always cut off text to fit in its allocated space on the report design (or expand it to the next line).

Can the jasperreports developers confirm this is still true in the current design and is there a way to go around this? Both excel (with cell overflow) and html (with tooltips) could use text even if it's not visible. Perhaps even pdf has tooltips? If jasperreports would like to go beyond print I believe some design choices should be revisited.

Post edited by: schrepfler, at: 2006/09/08 16:35

Link to comment
Share on other sites

  • 1 year later...

the Jasper engine will always cut off text to fit in its allocated space on the report design (or expand it to the next line).

 

This is still happening? Can someone confirm that there is no any property that can be set so as text not to be cut, while keeping a fixed column's width ?

Link to comment
Share on other sites

See the net.sf.jasperreports.print.keep.full.text property which was introduced in JR 2.0.3. The flag affects data-oriented exporters such as XLS and CSV.

 

This worked! Thank you very much Lucian.

 

Also, I searched further the forum and found a related issue.

 

But could I pass this property through java code;

Have searched in JRExporterParameter and in some subclasses, e.g. JRXlsExporterParameter, but nothing found.

 

Thanks again.

Link to comment
Share on other sites

kasiopi wrote:

But could I pass this property through java code;
Have searched in JRExporterParameter and in some subclasses, e.g. JRXlsExporterParameter, but nothing found.

 

This is not an exporter parameter, it is a report/global property which needs to be set when the report is filled so that the filler knows to preserver the entire texts. If this property is not set at the moment the report gets filled, the XLS exporter will not be able to display the entire texts since these texts would simply not be present in the filled report.

 

Regards,

Lucian

Link to comment
Share on other sites

  • 5 months later...
  • 1 month later...
  • 6 months later...
  • 2 weeks later...

huytran
Wrote:

I have the same problem. Can you give me the line of code that set that property?

If you want to set this propertly globally (i.e. for all texts in all reports, see below).

Regards,

Lucian

Code:
JRProperties.setProperty(JRTextElement.PROPERTY_PRINT_KEEP_FULL_TEXT, true);
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...