Wordpress - 将帖子的内容导出到 .docx

Wordpress - Export posts' content to .docx

首先请原谅我的英语不完善

我一直在到处挖掘,但找不到任何解决方案来解决我想要实现的目标。

我安装了一个 Wordpress,其中包含一些添加了一些自定义字段的帖子。我希望能够转到管理面板并勾选我要导出的帖子,然后一旦我单击一个按钮,就会生成一个 .docx 文件并准备下载,该文件将包含帖子的内容。

.docx 文件的布局需要如下所示:

POST 1 TITLE
post 1 content
post 1 custom field value

-----

POST 2 TITLE
post 2 content
post 2 custom field value

-----

POST 3 TITLE
post 3 content
post 3 custom field value

等等...

所以我基本上想要的是一个 php 脚本,它允许我从一些数据库表中提取所选帖子的数据并将其下载为 word/document。xml 格式,但我不知道从哪里开始,因为这个主题似乎没有涉及到任何地方。

如果有人好心为我指出正确的方向,那我会非常非常高兴。

非常感谢。

如果您想要手动解决方案: - 准备一个 PHP 文件,其中包含 WP_Query 或 "plain" SQL 查询 WP 数据库,以您需要的格式获取; - 使用 PHPOffice PHPWord https://github.com/PHPOffice/PHPWord 创建一个 DOCX 或 DOC 文件,并在其中填充获取的值

将帖子导出到 DOCX 的免费插件 - Aspose DOCX Exporter:https://wordpress.org/plugins/aspose-doc-exporter/

非免费:可以结合wpDataTables使用http://wpdatatables.com to pull the data that you need from the database, and the Report Builder add-on to generate Excel XLSX or Word DOCX document containing the data that you need, you can also prepare a template: http://wpreportbuilder.com/