如何生成 OpenOffice Draw 文档?

发布于 2024-09-27 15:14:58 字数 1495 浏览 1 评论 0 原文

我想在 OpenOffice Draw 中创建流程图。

由于需要显示很多步骤(并且将来可能会更改),但我可以提取数据,因此我想通过以下步骤自动创建:

  • 使用指定的页面设置创建一个新的 ODG 文档。
  • 插入具有指定属性的流程图形状。
  • 用箭头连接这些东西。
  • 理想情况下,自动将事物组织到合理的位置。

我不想花几个小时阅读一些“UNO”的东西 - 我只想要可以根据需要进行调整的代码示例。

如果示例代码使用 OO API,或者只是修改压缩模板内的 XML 文件,我不会感到困扰 - 只要它能让我足够轻松地完成上述操作即可。

我正在使用 Railo (CFML) 执行此操作,但我也可以使用 Java,或转换来自其他可读语言。

有什么建议如何解决这个问题吗?


更新:
我开始使用 XML 路径 - 我保存了一个空文件和一个包含单个对象的文件,并比较了这两个文件(视为 zip)以查看差异,然后重复几次进行不同的更改以帮助理解是什么正在进行中。

我有一些非常基本(且不完整)的代码,可以创建形状并连接它们,可以在这里看到:http://gist.github.com/634306

这非常粗糙,但我可能可以找到一种方法来使用我现在拥有的东西来生产我需要的东西 - 但我仍然希望有人能指出一种更好的方法来做到这一点 - 特别是因为我需要找出某种适当定位形状的方法,这不会是微不足道的。

我为第四点创建了一个独特的问题:
如何在流程图上自动布局框?

更新2:
从另一个问题中,我发现了 GraphViz 它可以根据数据可视化图表 - 并且我创建了一个 ' digraph' 来自我的数据 - 所以我需要的是一种转换 GraphViz 输出的方法< /a> 转换为 OpenOffice Draw 可以接受的内容。显然,人们认为会有 SVG,但似乎 OpenOffice 尚未正确实现 SVG然而,所以我需要想出另一个计划。

I want to create a flowchart in OpenOffice Draw.

Since there's a lot of steps to show (and may change in future) but I can extract the data, I want to automate the creation with the following steps:

  • Create a new ODG document with specified page settings.
  • Insert flow chart shapes with specified properties.
  • Connect those things with arrows.
  • Ideally, auto-organise things into sensible positions.

I don't want to spend hours reading about some "UNO" thing - I just want code examples that I can adapt as required.

Not bothered if the example code uses the OO API, or just modify XML files inside a zipped template - so long as it lets me do the above things easily enough.

I'm doing this with Railo (CFML), but I can also work with Java, or convert snippets from other readable languages.

Any suggestions how to go about this?

Update:
I've started playing with the XML route - I saved an empty file, and a file with a single object, and compared the two (treating as zips) to see the difference, then repeated a few times with different changes to help understand what's going on.

I have some very basic (and incomplete) code which can create shapes and connect them, which can be seen here: http://gist.github.com/634306

It's very crude, but I can probably work out a way to use what I've got now to produce what I need - but I'm still hoping that someone can point me towards a better way of doing this - particularly since I'll need to figure out some way of positioning the shapes appropriately, which wont be trivial.

I've created a distinct question for this fourth point:
How do I auto-layout boxes on a flowchart?

Update 2:
From that other question, I have discovered GraphViz which can visualise graphs from data - and I've created a 'digraph' from my data - so all I need is a way to convert the output of GraphViz into something which OpenOffice Draw can accept. The obvious thought there would be SVG, but it seems OpenOffice hasn't implemented SVG properly yet, so I need to come up with another plan.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

放赐 2024-10-04 15:14:58

您可以尝试 api.openoffice.org。让我知道这对你来说效果如何。

You could try api.openoffice.org. Let me know how that worked out for you.

小伙你站住 2024-10-04 15:14:58

您可以查看我的帖子,了解如何创建一个 OO 电子表格。该示例是 .NET,但应该可以轻松移植到 Java。我以前没有这样做过,但我假设您可以用 draw8 替换 writer8 来访问 OpenOffice Draw 引擎而不是电子表格引擎。如果您已经通过这种方式成功创建了电子表格,那么您可以查看有关如何添加形状和图形的 API。

You can checkout my post about how to create an OO Spreadsheet. The example is .NET but should be easily portable to Java. I haven't done it before but I would assume that you can replace writer8 with draw8 to access the OpenOffice Draw engine instead of the spreadsheet engine. If you have successfully created a Spreadsheet that way, then you can checkout the API about how to add Shapes and Figures.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文