You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Koundinya (Sudhakar Chavali)" <su...@yahoo.com> on 2004/05/14 15:18:34 UTC

Another Bug:- Is this Bug in Word API?

Hi Developers,

I wanted to know whether it is bug of POI or POI is not
supporting this document format (It seems The format is in Word
97 only). When I try to extract the text from the attached
document, I got the following error.

Exception in thread "main" java.io.IOException: block[ 0 ]
already removed
        at
org.apache.poi.poifs.storage.BlockListImpl.remove(BlockListImpl.java:
96)
        at
org.apache.poi.poifs.storage.BlockAllocationTableReader.fetchBlocks(B
lockAllocationTableReader.java:190)
        at
org.apache.poi.poifs.storage.BlockListImpl.fetchBlocks(BlockListImpl.
java:128)
        at
org.apache.poi.poifs.filesystem.POIFSFileSystem.processProperties(POI
FSFileSystem.java:403)
        at
org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSyste
m.java:102)
        at TestDocVer.main(TestDocVer.java:16)


You can download from here also
http://www.geocities.com/sudhakar_koundinya/tools.doc


Thanks,
sudhakar





P.S : My test Application 

import java.io.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.util.LittleEndian;
import org.apache.poi.hwpf.model.*;
import org.textmining.text.extraction.sprm.*;

import java.util.*;
import java.io.*;

public class TestDocVer 
{
	public static void main(String[] args) throws Exception
	{

		InputStream in=new FileInputStream(args[0]);
    POIFSFileSystem fsys = new POIFSFileSystem(in);

    // load our POIFS document streams.
    DocumentEntry headerProps =
        (DocumentEntry)fsys.getRoot().getEntry("WordDocument");
    DocumentInputStream din =
fsys.createDocumentInputStream("WordDocument");
    byte[] header = new byte[headerProps.getSize()];


    din.read(header);
    din.close();



    // determine the version of Word this document came from.
	    int nFib = LittleEndian.getShort(header, 0x2);
		System.out.println(nFib);

	}
}


=====
"No one can earn a million dollars honestly."- William Jennings Bryan (1860-1925) 

"Make everything as simple as possible, but not simpler."- Albert Einstein (1879-1955)

"It is dangerous to be sincere unless you are also stupid."- George Bernard Shaw (1856-1950)


	
		
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org