generating javadoc as a word document

空扰寡人 提交于 2019-12-04 02:39:17
Mark

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

You can't generate a Word document directly. However, you could try to generate Word document(s) from generated html files: Search Google

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!