This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Bold font using FileWriter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Bold font using FileWriter" Watch "Bold font using FileWriter" New topic
Author

Bold font using FileWriter

Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
Hi
The following will add an attribute Emp Name to myfile in a normal font style. But i want this to be added in BOLD font. How to achieve this


[ November 12, 2008: Message edited by: Srinivasa Maddi ]
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
Plain text files by themselves do not contain any font information. You need to add extra information for that. Decide upon a file format which supports fonts like rtf, html, odf, pdf etc... and use that for your file.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
What file format is this? Plain text files do not have a concept of styling text in any way.

Also, what do you mean by "attribute"? Would this be text in the file contents, or something else (like document attributes)?

Just to state the obvious, you're aware that "add" is not a method in FileWriter, right?
[ November 12, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
Its a CSV format file. Here attribute i mean a "Column Label Name" which is getting retrieved from the database.
[ November 12, 2008: Message edited by: Srinivasa Maddi ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
CSV does not support text styling. If you want something that opens in Excel and which supports text styling, you can use the Apache POI library to create XLS files.
Srinivasa Maddi
Ranch Hand

Joined: Apr 18, 2007
Posts: 60
Thank You Ulf.
 
 
subject: Bold font using FileWriter
 
Similar Threads
Dynamically Creating Files......
How to boldface the header for ONE column
Printwriter not writing complete data
Problem with applying font-weight
Writting a String to a file