File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do we do a Text Wrap

 
bob leduc
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to wrap at 15 characters without chumping the words.
Eg: hello, could anyone help? It would be really appreciated.
result: >hello, could_
>anyone help?__
>It would be_
>really_
>appreciated.
this (_) signifies an empty space
It would be greatly appreciated if you can show me an example. Thanks again!
 
bob leduc
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The functionality needed is as show below:
The original string:
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog again. The quick brown fox jumps over the lazy dog one more time.
The string word wrapped at 40 characters:
The quick brown fox jumps over the lazy
dog. The quick brown fox jumps over the
lazy dog again. The quick brown fox
jumps over the lazy dog one more time.
Originally posted by bob leduc:
I want to wrap at 15 characters without chumping the words.
Eg: hello, could anyone help? It would be really appreciated.
result: >hello, could_
>anyone help?__
>It would be_
>really_
>appreciated.
this (_) signifies an empty space
It would be greatly appreciated if you can show me an example. Thanks again!
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is one way of doing it.

Hope that helps.
 
Dan Allen
Author
Ranch Hand
Posts: 164
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One small change. If the break occurs at the end of a word, an extra space would preceed the following line. Take note to the updated code.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic