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

word wrap - again


Apemant

Recommended Posts

I've seen topics with this issue before but no answers.

 

Word wrapping in text fields is turned on by default and there is no way of turning it off. It is not so much of a problem if your textfield is supposed to grow (then you usually WANT it to be nicely wrapped), but if you need a text field to stay fixed height, and display as much text as possible in a line, then you wind up with half of your text eaten by the wrapping mechanism.

 

Looking at the source code, I see it is the result of using java.awt.font's LineBreakMeasurer, the constructor without explicit BreakIterator argument, which then by default uses BreakIterator.getLineInstance(), for line wrapping at word boundaries. So, all that would be needed is to somehow make it customizable, perhaps adding a boolean flag (isWordWrap) to JRXXXTextField or even JRXXXTextElement classes and then create LineBreakMeasurer with different BreakIterator factory instances, depending on that flag.

 

It seems strange to me that such a sophisticated tool lacks so simple a feature... when I considered moving to Jasper I looked at more advanced topics and it seemed to satisfy them all; now that I already built an old-reporting-tool-to-Jasper automatic converter and converted all my reports, I see that this annoying trifle is missing. Argh :S

Link to comment
Share on other sites

  • 3 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

If you want the text to go to the left as far as it can, why don't you put a very long text field? Maybe as wide as the page width itself?

 

Or do you expect that when the text expands it should push the other elements found at the right?

If you do expect this, then what do you want us to do with the elements that go outside the page width because they were pushed? What kind of page break should we introduce?

 

Note that JasperReports was created with printing in mind and the concept of page is built-into the engine.

 

Please describe in detail the complete behavior you expect from such a feature as even though it came up many times on the forums, nobody was able to fully describe how the engine should work in such cases.

 

Thank you,

Teodor

Link to comment
Share on other sites

  • 3 years later...

 I can somehow empathize with Apemant.

I face the same issue.

In my case I want the cell in an excel to NOT have the text wrapped. In case of Excel, it should just display whatever it can in the cell width and the remaining is just not seen. This is normal behavior in Excel.

 

Thanks

hsagwadawala

 

Link to comment
Share on other sites

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...