ria
ria

Reputation: 7974

generating javadoc as a word document

How can we generate javadoc as a word document instead of the traditional html pages?

Upvotes: 10

Views: 19503

Answers (4)

Mark
Mark

Reputation: 14930

look into doclets, http://doclet.com which have plenty of examples of custom javadoc rendering (i.e into PDF's etc...) and also look into Apache POI (http://poi.apache.org/) for the generation of MS Office files

Upvotes: 7

Tommy
Tommy

Reputation: 809

You can use maven to run the pdfdoclet. Though I did not find any "official" maven repository the following seems more clear to me, opposed to fiddling with shell scripts or using ant-commands in maven as proposed on their website:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.9.1</version>

            <configuration>
                <doclet>com.tarsec.javadoc.pdfdoclet.PDFDoclet</doclet>
                <docletPath>path/to/pdfdoclet-1.0.2-all.jar</docletPath>
                <useStandardDocletOptions>false</useStandardDocletOptions>
            </configuration>
        </plugin>

Note the disabling of the standard options, otherwise javadoc complains of unknown options (apparently not supported by the pdfdoclet)

From there you can start customizing, using the ever-concise maven documentation

Upvotes: 1

weberjn
weberjn

Reputation: 1985

http://doclet.com/ links an RTF Doclet ("RTF Doclet generates RTF format documentation.") The resulting RTF opens in Word and Open Office Writer.

Upvotes: 1

remipod
remipod

Reputation: 11709

If you could live with pdf instead of word, you should give PDFDoclet a chance. I discovered it on doclet.com (thanks to Mark for the link). It works quite well, is easy use and allows some configuration. For my purpose, pdf is better suited than word because a pdf document is better suited for reading than a word in regard to the needed viewer application.

Here is my small windows batch file:

echo OFF

set JAVA_HOME=C:/program files/Java/jdk1.6.0_23
set PATH=%JAVA_HOME%/bin;%PATH%
set VERSION=1.0.2
set DOCLET=com.tarsec.javadoc.pdfdoclet.PDFDoclet
set JARS=jar/pdfdoclet-%VERSION%-all.jar
set PACKAGE="cvu.html"

javadoc -doclet %DOCLET% -docletpath %JARS% -pdf html.pdf -config example/html/config_html.properties -private -sourcepath example/html -subpackges %PACKAGE%

Upvotes: 4

Related Questions