是否有可以创建丰富Word文档的Java API? [英] Is there a Java API that can create rich Word documents?

查看:136
本文介绍了是否有可以创建丰富Word文档的Java API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新的应用程序,我将在哪里生成一个包含表格,图形,目录和文本的Word文档。什么是一个很好的API用于此?你有多确定它支持图形,ToC和表格?使用它们有什么隐藏的问题?

I have a new app I'll be working on where I have to generate a Word document that contains tables, graphs, a table of contents and text. What's a good API to use for this? How sure are you that it supports graphs, ToCs, and tables? What are some hidden gotcha's in using them?

一些澄清:


  • I无法输出PDF,他们需要Word文档。

  • 他们使用的是MS Word 2003(或2007),而不是OpenOffice

  • 应用程序在* nix app-server上运行

如果我可以从模板doc开始并填写一些空格,那就太好了有表格,图表等。

It'd be nice if I could start with a template doc and just fill in some spaces with tables, graphs, etc.

编辑:下面有几个很好的答案,每个答案都有我自己的错误,就我目前的情况而言。很难从他们那里选择最终答案。想想我会保持开放,希望能够创建更好的解决方案。

Several good answers below, each with their own faults as far as my current situation. Hard to pick a "final answer" from them. Think I'll leave it open, and hope for better solutions to be created.

编辑:OpenOffice UNO项目似乎与我的要求最接近。虽然POI肯定是主流,但它对我想要的东西来说太不成熟了。

The OpenOffice UNO project does seem to be closest to what I asked for. While POI is certainly more mainstream, it's too immature for what I want.

推荐答案

2007年我的项目成功使用了OpenOffice.org的< a href =https://www.openoffice.org/udk/common/man/uno.html\"rel =noreferrer>通用网络对象(UNO)界面,以编程方式生成与MS-Word兼容的文档( * .doc),以及相应的PDF文档,来自Java Web应用程序(Struts / JSP框架)。

In 2007 my project successfully used OpenOffice.org's Universal Network Objects (UNO) interface to programmatically generate MS-Word compatible documents (*.doc), as well as corresponding PDF documents, from a Java Web application (a Struts/JSP framework).

OpenOffice UNO还允许您构建与MS-Office兼容的图表,电子表格,演示文稿等。我们能够动态构建复杂的Word文档,包括图表和表格。

OpenOffice UNO also lets you build MS-Office-compatible charts, spreadsheets, presentations, etc. We were able to dynamically build sophisticated Word documents, including charts and tables.

我们使用带有书签插入的模板MS-Word文档简化了流程,软件插入了内容,但是,您可以从头开始构建文档。目标是让软件生成报告文档,这些文档可以由最终用户共享和进一步调整,然后再将其转换为PDF以进行最终交付和归档。

We simplified the process by using template MS-Word documents with bookmark inserts into which the software inserted content, however, you can build documents completely from scratch. The goal was to have the software generate report documents that could be shared and further tweaked by end-users before converting them to PDF for final delivery and archival.

如果您希望用户使用OpenOffice而不是MS-Office,您可以选择以OpenOffice格式生成文档。在我们的例子中,用户想要使用MS-Office工具。

You can optionally produce documents in OpenOffice formats if you want users to use OpenOffice instead of MS-Office. In our case the users want to use MS-Office tools.

UNO包含在OpenOffice套件中。我们只是将Java应用程序链接到套件中与UNO相关的库。提供了 OpenOffice软件开发工具包(SDK),其中包含示例应用程序和UNO开发人员指南。

UNO is included within the OpenOffice suite. We simply linked our Java app to UNO-related libraries within the suite. An OpenOffice Software Development Kit (SDK) is available containing example applications and the UNO Developer's Guide.

我没有调查最新的OpenOffice UNO是否可以生成MS-Office 2007 Open XML文档格式。

I have not investigated whether the latest OpenOffice UNO can generate MS-Office 2007 Open XML document formats.

关于OpenOffice UNO的重要事项是:

The important things about OpenOffice UNO are:


  1. 它是免费软件

  2. 它支持多种语言(例如Visual基础,Java,C ++和其他)。

  3. 它与平台无关(Windows,Linux,Unix等)。

以下是一些有用的网站:

Here are some useful web sites:

  • Open Office home
  • Open Office UNO Developer's Guide
  • OpenOffice Developer's Forum (especially the "Macros and API" and "Code Snippets" forums).

这篇关于是否有可以创建丰富Word文档的Java API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆