This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to get Java code into a Word document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to get Java code into a Word document" Watch "How to get Java code into a Word document" New topic

How to get Java code into a Word document

Thomas Hawk

Joined: Oct 01, 2004
Posts: 9
I have a number of Java source files that I need to include in a technical document (MS Word format). Is there a tool that will take all the source files for a project and either create a new word document or import them into an existing word document? I would like to preserve the original source code formatting and it would be great if file name headings were automatically added to the word document, though I can live without this latter capability. Thanks for any help you all can provide.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19351

I am fairly certain you could write a Word macro to get all the files with a certain extension in a certain directory and format them any way you liked.
Guru dhaasan
Ranch Hand

Joined: Sep 13, 2006
Posts: 126

you can use some extenral utilities like textpad and then try to copy form there to word

Thanks, Shiv
SCJP, OCE - JSP & Servlets Developer
I agree. Here's the link:
subject: How to get Java code into a Word document