Questions tagged [hwpf]

Apache POI - HWPF - Java API to Handle Microsoft Word Files

HWPF is the name of a port of the Microsoft Word 97(-2007) file format to pure Java as part of the project. It also provides limited read only support for the older Word 6 and Word 95 file formats.

See the Apache POI homepage for details.

46 questions
0
votes
1 answer

Apache POI replaceText() side effect, changes line space

I am using POI 3.15 in Java to replace some text in my .doc template. private HWPFDocument replaceText(HWPFDocument doc, String findText, String replaceText) { Range r = doc.getRange(); for (int i = 0; i < r.numSections(); ++i) { …
Maxi Wu
  • 1,274
  • 3
  • 20
  • 38
0
votes
0 answers

how to convert a vsd/vsdx file to image(eg. jpg png) using apache poi

I'm using apache poi to read doc/docx files. Now I can extract paragraphs and pictures from my doc file. When there is a vsd in my doc file, how can i convert the vsd to a png image? I tried this: private byte[] emfConversionPng(DocPictureData…
赵祥宇
  • 497
  • 3
  • 9
  • 19
0
votes
2 answers

getTableLevel() method of org.apache.poi.hwpf.usermodel.Paragraph

I am trying to modify the existing code which converts MS word documents to text using apache POI. I am new to this Apache POI API. There is GetTableLevel() method of org.apache.poi.hwpf.usermodel.Paragraph class which returns some integer value.…
Shekhar
  • 11,438
  • 36
  • 130
  • 186
0
votes
0 answers

How to save doc file with anchor image by using Apache POI HWPFDocument

I am using HWPFDocument to modify some doc file. However, when I try to save a new doc file with anchor image, the image will become broken. Does any method that can handle this case? Here are some my codes. File file = new…
KC L
  • 79
  • 1
  • 6
0
votes
1 answer

write data into excel file after extracting the paragraphs/Strings from HWPFDocument(.doc files)

Here my code helps me to extract the data from .doc files into paragraphs and specific string search as well.i can take it manual output using eclipse run configuration. but 1) i wanted it to direct output into excel file where it is .doc file.2)…
shravan
  • 23
  • 9
0
votes
1 answer

Adding images and editing headers in .doc using java

I want to edit header of a .doc(word) document. Below code I have written : import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.usermodel.CharacterRun; import org.apache.poi.hwpf.usermodel.Paragraph; import…
0
votes
1 answer

HWPF-POI:The table insert into doc with poi hwpf is not visible

I want to insert a table at a specific position with poi, the table is generated, but I find this table is not visible. The generated table in doc is visible when previewing or editing this doc with macOS and its text tool, POI can read the table…
0
votes
1 answer

I have a table in Word with POI-HWPF Can I insert another table into a cell in the tabel?

I have a table in Word with POI-HWPF. Can I insert another table into a cell in the table?
tracis
  • 1
  • 1
0
votes
1 answer

Convert dot to dotx in JAVA

I have a .dot file using which i will be creating doc file with values replaced. eg: .dot file having I will replace with real claim Id say 1234 and generate a doc file. I am using Apache POI HWPFDocument, when using HWPFDocument…
Arasu
  • 2,078
  • 6
  • 40
  • 67
0
votes
1 answer

HWPF-POI: inserting table in word with java

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…
Louisa
  • 55
  • 10
0
votes
1 answer

Read .doc file content and write into pdf file in java

I'm writing a java code that utilizes Apache-poi to read ms-office .doc file and itext jar API's to create and write into pdf file. I have done reading texts and tables printed in the .doc file. Now i'm looking for a solution that reads images…
nagesh
  • 307
  • 2
  • 10
  • 22
0
votes
1 answer

how to set linespacing using docx4j api?

Blockquote Hi, I am trying to convert doc to docx using docx4j api.I need to set line spacing as required. Blockquote
user2211381
  • 31
  • 1
  • 2
  • 3
0
votes
1 answer

Set color text in doc file using apache poi

I used this code snippet to set color text in MS Word file CharacterRun r = paragraph.getCharacterRun(2).insertBefore("x"); r = r.insertBefore("y"); r.setColor(6); r.insertBefore("z); I want to set color to only "y" character but the result I got…
thoitbk
  • 269
  • 2
  • 9
  • 21
0
votes
1 answer

Some HWPF POI document building examples

I'm looking for examples of building non-trivial Word (97-2003) documents with POI. I already reached to create one with "Hello World": package com.mygroup.myapp.poi.word; import java.io.File; import java.io.FileNotFoundException; import…
Marc de Verdelhan
  • 2,501
  • 3
  • 21
  • 40
-3
votes
1 answer

the problems with read Doc or Docx file in java netbeans

Possible Duplicate: the problems with read Doc or Docx file in java I'm have a problems with programs read file word in java.Then I run programs,it's report error as follows:java.lang.NoClassDefFoundError: org/apache/poi/hwpf/HWPFDocument at…