Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Show file .doc in una panel or JTextArea  RSS feed

 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody!!!

i'm i want open one file .doc or .docx and insert in una panel or one JTextArea....

in my JTextArea append only file .txt

how to do???

help!!!
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> how to do???

what did google turn up?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt that there are non-commercial Swing objects that can display structured document formats like those. Some basic RTF and HTML - yes, but DOC/X - no.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen on google libraries org.apache.poi able to read formats. doc and. docx ...
I can't understand how to use them to get what you want ...
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paul beppe wrote:I have seen on google libraries org.apache.poi able to read formats. doc and. docx ...
I can't understand how to use them to get what you want ...


That's because reading those formats is very different from rendering them in a GUI. In other words, you can't use those products (which were designed to read those formats) to display data in a GUI.
 
paul beppe
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!!!

in this days i have search do soluction....

in java i can convert the file .doc/x to .html

and later insert html setected in JTextArea....

it's possible???

if possible how to do???

help me please!!!
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may be able to use OpenOffice in server mode to convert structured formats; check out the JODConverter library.

The best quality approach might be to convert the document to PDF, and then use the PDF-Renderer library to display it - it comes with a Swing component for displaying PDFs.

That begs the question, though: why convert the document at all? Why not use Desktop.open(...) to use a native application?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!