开发者

generating javadoc as a word document

开发者 https://www.devze.com 2022-12-09 17:42 出处:网络
How can we generate javadoc as a word document 开发者_如何学JAVAinstead of the traditional html pages?look into doclets, http://doclet.com which have plenty of examples of custom javadoc rendering (i.

How can we generate javadoc as a word document 开发者_如何学JAVAinstead of the traditional html pages?


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


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%


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消