是否有适用于 Delphi(非 OLE)的 OpenOffice.org 导出组件?
对于文档交换,我想生成 OpenOffice.org 文本和电子表格文档。 到目前为止,我已经找到需要使用 OLE 安装 OpenOffice 的导出组件。
是否已经有可用的 Delphi 组件可以为 OpenOffice.org Writer 或 OpenOffice.org Calc 编写本机文件?
For document exchange, I would like to generate OpenOffice.org text and spreadsheet documents. So far I have found export components which require OpenOffice to be installed, using OLE.
Are there already Delphi components available which can write native files for OpenOffice.org Writer or OpenOffice.org Calc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于您的文件有多复杂以及您想要投入多少精力。
OpenOffice.org 文档(从 OO.org 版本 2 开始)是 OpenDocument 格式,基本上是具有文档结构的压缩目录,包含各种 XML 和支持文件。 例如,您可以使用 7-Zip 的“Open Inside”命令来导航文件,就像目录。
这至少为您提供了以下选项:
自己编写代码来输出文档,Delphi 流类和压缩支持应该足够了。 这显然是最困难的方法,但一切都在你的掌控之中。
将最少的文档保存为模板文件,并将它们作为外部支持文件甚至嵌入式资源添加到您的应用程序中。 当需要写入文件时,您可以复制模板并编辑根目录中的 content.xml 文件。 这应该容易得多,我可能会用这种方式创建一个简单的电子表格文件,其中包含多个工作表和数据列。
如果您已经拥有许可证或者不介意付费,FastReport VCL 支持“Office 应用程序开放文档格式 (OASIS) 导出、电子表格 (ods) 和文本 (odt)”。 也许还有其他报告解决方案,但 FastReport 是我确信的解决方案。
It depends on how complicated your documents are, and how much effort you want to invest.
OpenOffice.org documents (starting with version 2 of OO.org) are files in the OpenDocument Format, basically zipped directories with a documented structure, containing various XML and support files. You can use for example the "Open Inside" command of 7-Zip to navigate the files like a directory.
That gives you at least the following options:
Write the code to output the documents yourself, the Delphi stream classes and compression support should be sufficient. This is obviously the most difficult way, but you would have everything under your control.
Save minimal documents as template files and add them to your application as external support files or even as embedded resources. When a file needs to be written you copy the template and edit the content.xml file in the root directory. This should be a lot easier, a way I would probably go to create for example a simple spreadsheet file with several sheets and columns of data.
If you already have the license or don't mind to pay for it, FastReport VCL supports "Open Document Format for Office Applications (OASIS) exports, spreadsheet (ods) and text (odt)". Maybe there are other reporting solutions as well, but FastReport is the one I'm sure of.
FPC/Lazarus的fpspreadsheet组件可以直接写入较旧的Excel格式,OOO可以打开它们。 如果您需要电子表格而不是文本文档,可以选择看看是否可以将其移植到 Delphi。
FPC/Lazarus' fpspreadsheet component can directly write older Excel formats, and OOO can open them. If you need spreadsheets rather than textdocuments, it could be an option to see if it can be ported to Delphi.
在 Lazarus 中,我使用 zexmlss 组件导出到 ODS。 该组件适用于 lazarus、delphi 和 builder。 仅适用于电子表格。 公式运行良好。
In Lazarus I am use zexmlss component for export to ODS. This component for lazarus, delphi and builder. Only for spreadsheets. Formulas working fine.