Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How to replace certain strings in a word document with java?

Hi,

So I have some strings stored in arrays in my java program that i'd like to be put in a template in word.

How can i make the program find a bookmark string in the word document where i want the string stored in "anArray[1]" to go and then replace it with the string in "anArray[1]"?

Thanks

1 Answer

Relevance
  • Anonymous
    8 years ago
    Favorite Answer

    You should consider using a PrintWriter object to write the String to a File. It works the same as using System.out, as the out variable is a PrintWriter. Just create a new object using the File as the param. So something like:

    view sourceprint?

    1

    PrintWriter write = new PrintWriter(new File("path.extension"));

Still have questions? Get your answers by asking now.