是否可以从与HTML和CSS构建网页相似的代码中构建Libreoffice文档?

发布于 2025-01-23 20:27:00 字数 458 浏览 6 评论 0原文

是否可以从与HTML和CSS构建网页相似的代码中构建Libreoffice文档?一个人可以编写一个ODF文件,其中内容和样式是分开的,然后在libreoffice中打开/查看?如果是这样,一个人可以像为HTML/CSS完成的文本编辑器中编写代码吗?

我现在要问的两个原因。 1)当我需要在libreoffice中进行风格更改时,我必须在一百个地方手动进行相同的调整,例如改变块引号的风格。 2)我想从文本数据库构建文档。

我找到了一个问题与数据库有关,但大约八年了。

感谢您可能提供的任何方向。

Is it possible to build a LibreOffice document from code similar to the way a web page is built from HTML and CSS? Can one write an ODF file in which the content and styling are separate, and then/view open in LibreOffice? If so, can one write the code in a text editor as done for HTML/CSS?

There area two reasons I now ask. 1) When I need to make a style change in LibreOffice I have to manually make the same adjustments in a hundred places, such as changing the style of block quotes. 2) I'd like to build documents from a database of text.

I found a question on this in relation to databases but it was about eight years old.

Thank you for any direction you may be able to provide.

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

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

发布评论

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

评论(1

‘画卷フ 2025-01-30 20:27:00

解压缩一个.odt包含样式的文件。您将看到两个文件,content.xmlstyles.xml。使用文本编辑器编辑这些文件,然后将文件夹缩回以获取修改后的.odt文件。

请注意,XML文件中有两种样式。命名样式是大多数人认为样式的样式,而自动样式是自定义格式的,例如当您选择一些文本并直接更改字体时。

Tohuwawohu的链接描述了与文件一起编程工作的实用程序。另外,如链接中所述,自己编写代码并不难。例如,在python中,导入内置库zipfilexml.etree

Unzip an .odt file that contains styles. You will see two files, content.xml and styles.xml. Edit these files using a text editor and then zip the folder back up to get a modified .odt file.

Be aware that there are two types of styles in the XML files. Named styles are what most people think of as styles, whereas automatic styles are custom formatting, like when you select some text and change the font directly.

The link from tohuwawohu describes utilities to work programmatically with the file. Also as mentioned in the link, it's not too hard to write code yourself. For example in python, import the built-in libraries zipfile and xml.etree.

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