Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to present a content of a documeent as a String?

Status
Not open for further replies.

thelordoftherings

Programmer
May 16, 2004
616
IL
Hello,

I have a certain byte array - byte[] b - that contains a content I've read from a certain word file.
I would like to present this content as a String, is it possible to do it?
 
Found the solution: The server name need not be in it's fully qualified name, e.g. this won't work: servername.companyname.com.
 
So you changed your mind. Then you just need to

Code:
FileInputStream stream = new FileInputStream("sample.rtf");
RTFEditorKit kit = new RTFEditorKit();
Document doc = kit.createDefaultDocument();
kit.read(stream, doc, 0);

String plainText = doc.getText(0, doc.getLength());

[code]

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top