Results 1 to 6 of 6
  1. #1
    Frys82 is offline Member
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Default Importing text into a word document

    Hello again,

    I was just wondering is there any way to import a block of text ( say from a JTextArea or something similar) into a word document and still keep its layout? I've just started working on this problem so I don't have much work to show. All I want to do is when a user clicks a button, whatever is in the text area is copied over to a word document ready for printing. If could give me some ideas on how to approach this it would be extremely helpful. Thanks in advance

    Frys82

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You should start with a component that allows formatting in the first place.

    java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html should be a good place to start.

  3. #3
    Frys82 is offline Member
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Default

    Hello, I seem to have solved it. I'm using a action listener on a button and whenever it is pressed it used a PrintWriter to print whatever is in the JEditorPane to a ".doc" file. Thanks anyway

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Glad you got it working. I hope you have all that in its own separate thread too. You shouldn't be running I/O tasks on the EDT.

  5. #5
    Frys82 is offline Member
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Default

    I think I might be, be it works none the less and you can't argue with results

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    You'll realize soon enough that it's better to do things the correct way early on.

Similar Threads

  1. writing word document using poi hwpf
    By devday in forum New To Java
    Replies: 4
    Last Post: 08-07-2011, 12:15 PM
  2. How to create a table in word document using hwpf
    By devday in forum Advanced Java
    Replies: 0
    Last Post: 07-23-2009, 03:41 PM
  3. Reading Microsoft Word Document in JAVA
    By satheeshtech in forum Advanced Java
    Replies: 0
    Last Post: 07-18-2009, 09:21 AM
  4. copying contents from word document to JTextPane
    By success21061985 in forum Advanced Java
    Replies: 1
    Last Post: 11-05-2008, 07:09 AM
  5. Saving word document from iframe
    By anil@netedgecomputing.com in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-15-2008, 12:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •