Read doc file in java using poi

package com.howto;


import org.apache.poi.hwpf.HWPFDocument;

 * Here we will learn how to read a Doc file
public class ReadDocFile {

	public static void main(String args[]) throws IOException {
		 * Create input stream of the doc file - Provide exact path of the doc
		 * file to read
		FileInputStream fistream = new FileInputStream(
		HWPFDocument document = new HWPFDocument(fistream);

		System.out.println("Length of docment is :"
				+ document.characterLength());






Here we will use POI open source project to read windows doc file. PoI Jar will be required that can be downloaded from apache website.

4 thoughts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top Search