转换docx,更改数据并再次转换docx

时间:2019-12-03 15:15:57

标签: java spring apache-poi docx docx4j

我有一个docx文件,其中包含需要填充的某些部分/填充。 我正在尝试使用 Docx4J JAXB 解析文件。 如果docx是简单格式且未格式化,则很好。

我的docx文件的上部包含“地址”。然后是身体,然后是有样式的桌子。 在使用Docx4J时,我收到了文本,但无法得到样式。

我脑子里有办法,但是只是想知道我们是否有针对此类案件的更好的图书馆或办法。

**Approaches:**
1. To convert docx in zip, extract the styles.xml. Change the text whereever i want to do and then inject the styles again. Create zip and convert to docx.
2. Any libraries which gives me styles with the text -- if any please let me know
3. Get the text and create the docx again on our own by including the styles.

请让我知道我可以使用什么或最好的使用方式。

示例Docx: 假设我必须将“公司”一词更改为“组织”。

如果您需要我的更多信息,请告诉我。

0 个答案:

没有答案