hwpf

Java: parsing ms-word document using POI/HWPF

笑着哭i 提交于 2019-12-23 17:05:26
问题 I have a ms-word document (MS-Office 2003; non-xml). Within this document there is a string associated with a bookmark. Furthermore, the word document contains word-macros. My goal is to read the document with java, replace the string associated with the bookmark, and save the document back to word format. My first approach was using Apache POI HWPF: HWPFDocument doc = new HWPFDocument(new FileInputStream("Test.doc")); doc.write(new FileOutputStream("Test_generated.doc")); The problem with

Apache POI HWPF - problem in convert doc file to pdf

我们两清 提交于 2019-12-20 14:05:13
问题 I am currently working Java project with use of apache poi. Now in my project I want to convert doc file to pdf file. The conversion done successfully but I only get text in pdf not any text style or text colour. My pdf file looks like a black & white. While my doc file is coloured and have different style of text. This is my code, POIFSFileSystem fs = null; Document document = new Document(); try { System.out.println("Starting the test"); fs = new POIFSFileSystem(new FileInputStream("

HWPF-POI: inserting table in word with java

和自甴很熟 提交于 2019-12-12 01:55:19
问题 I want to create a table in Word with POI-HWPF (e.g. doc format). My example code is: Table table = document.getRange().insertTableBefore((short) 2, 2); The table is inserted, but I can't see it - as if the table has the width 0. Can anybody help me? 回答1: The file linked in this old bug report should give you an idea how to do it. So in essence: You probably need to add some content (i.e. a paragraph in a cell) so that Word has something to render. Here is the example code used in the bug

Inserting a base64 encoded image into xsl-fo file while using apache-poi

淺唱寂寞╮ 提交于 2019-12-10 14:31:30
问题 I am using Apache POI to convert .doc to .fo using the WordToFoConverter class, I have converted the images in the word file to base64, but how do i append it to the xsl-fo code generated by apache-poi? Consider the sample fo file generated by Apache-POI- <?xml version="1.0" encoding="UTF-8" standalone="no"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="page-page0" page-height="11.0in" page-width="8.5in"> <fo:region-body

Edit Microsoft-office .doc file in java using Apache POI

风格不统一 提交于 2019-12-08 03:43:26
问题 I'm writing java code to achieve the followings. 1.Read given Microsoft-office document(.doc) file. 2.Search for given string in the file. 3.Delete the given String located in any place. 4.Insert or replace any given string at specified position. 5.Write and save the updated file content into new .doc file. I have written a code to read, search, insert or replace, delete and save the file and it's working good, but i couldn't able to preserve the text format(such as font color, font size,

Apache POI jar has no hwpf package

大憨熊 提交于 2019-12-08 02:53:58
问题 I have downloaded the poi api jar files from this link's first mirror link,which is suggested. After downloaded I saw that org.apache.poi.hwpf package is not present there. Actually my work is completely depends on that API. So can anybody please tell me the proper link to download hwpf API . Actually my work is to read a MS Word file with some text as well as some table and then edit the values of the table rows. If any other API is also suitable for this kind of work, you please suggest me

the problems with read Doc or Docx file in java [closed]

ⅰ亾dé卋堺 提交于 2019-12-04 07:05:24
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . I am having this problem with reading a .doc or .docx file in Java: java.lang.NoClassDefFoundError: org/apache/poi/hwpf/HWPFDocument I don't understand

Apache POI HWPF - problem in convert doc file to pdf

妖精的绣舞 提交于 2019-12-03 03:21:41
I am currently working Java project with use of apache poi. Now in my project I want to convert doc file to pdf file. The conversion done successfully but I only get text in pdf not any text style or text colour. My pdf file looks like a black & white. While my doc file is coloured and have different style of text. This is my code, POIFSFileSystem fs = null; Document document = new Document(); try { System.out.println("Starting the test"); fs = new POIFSFileSystem(new FileInputStream("/document/test2.doc")); HWPFDocument doc = new HWPFDocument(fs); WordExtractor we = new WordExtractor(doc);