我想在MS Word文檔中獲取用Textbox寫的信息。我使用Apache POI來解析word文檔。如何使用Apache POI從MS Word文檔的文本框中獲取文本?
目前我遍歷所有的段落對象,但這段落列表不包含來自TextBox的信息,所以我在輸出中缺少這些信息。
例如
paragraph in plain text
**<some information in text box>**
one more paragraph in plain text
什麼我想提取:
<para>paragraph in plain text</para>
<text_box>some information in text box</text_box>
<para>one more paragraph in plain text</para>
什麼我得到目前:
款明文
以純文本
多了一個段落任何人都知道如何使用Apache POI從文本框中提取信息?
格式:doc或docx? – JasonPlutext 2011-03-30 11:25:56
@plutext,以doc格式開頭,但後來需要爲docx和rtf做同樣的事情。 – Shekhar 2011-03-31 10:44:51
您可以考慮使用JODConverter + LibreOffice將所有三種格式轉換爲docx,然後使用POI(或docx4j)從docx中提取文本框內容。這樣你就不必擔心二進制格式,或者解析rtf。 – JasonPlutext 2011-03-31 12:07:15