File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How we bold StringBuffer object text? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How we bold StringBuffer object text? " Watch "How we bold StringBuffer object text? " New topic
Author

How we bold StringBuffer object text?

Thakur Sachin Singh
Ranch Hand

Joined: Jun 15, 2010
Posts: 232

can anyone tell me, how we bold the text f StringBuffer class object and is there any logic to bold only one word of StringBuffer class object?


Here i want to bold only one word which is sachin, is there any possibility to this? if yes then how and no then how we bold all text of sb1 object?


SCJP 6- 91%, IBM DB2, IBM RAD Certified
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
StringBuffer has no concept of formatting. In which context are you displaying the contents of the SB where you want to apply formatting?
Thakur Sachin Singh
Ranch Hand

Joined: Jun 15, 2010
Posts: 232

actually i am using jasper report to print the text using valueList[], in whole string i want to apply bold to some words.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10169
    
    8

Does Jasper report support html? If yes, simple <b> tag might work


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Thakur Sachin Singh
Ranch Hand

Joined: Jun 15, 2010
Posts: 232

no i am sending the text from action class and this action class is java file, here i can not use html tags.
Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 157

Thakur Sachin Singh wrote:no i am sending the text from action class and this action class is java file, here i can not use html tags.

Thakur, I think that Maneesh means that you should try including a <b> tag within your StringBuffer, like this:


If memory serves me right, Jasper does allow HTML formatting. You just have to set the correct property on the report field.


"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." - George Bernard Shaw
Thakur Sachin Singh
Ranch Hand

Joined: Jun 15, 2010
Posts: 232

yes but this is not working on the report. html tags print as it is like text and not give any impact on the text.
Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 157

Thakur Sachin Singh wrote:yes but this is not working on the report. html tags print as it is like text and not give any impact on the text.

Re-read the last sentence of my previous response. You need to set a property on your reports element before it will "understand" HTML formatting.
Thakur Sachin Singh
Ranch Hand

Joined: Jun 15, 2010
Posts: 232

can you show me how?
Riaan Nel
Ranch Hand

Joined: Apr 23, 2009
Posts: 157

Thakur Sachin Singh wrote:can you show me how?

The first hit for "Jasper Reports HTML Markup" on Google
 
 
subject: How we bold StringBuffer object text?
 
Similar Threads
equals() in StringBuffers
Wait question from K&B threads chapter
K&B doubt
Doubt in String Buffer
Doubt in StirngBuffer