[Building Sakai] How to Using POI library in Sakai project?

Tram Bao baotram144 at gmail.com
Mon Mar 5 01:01:19 PST 2012


Dear all,
I've use POI library in my project. POI library consist 3 package:
poi-3.7-20101029.jar; poi-ooxml-3.7-20101029.jar;
poi-scratchpad-3.7-20101029.jar
I add dependency in pom.xml:

    <dependency>
           <groupId>poi</groupId>
           <artifactId>poi</artifactId>
          <version>3.7-20101029</version>
        </dependency>
        <dependency>
           <groupId>poi</groupId>
           <artifactId>poi</artifactId>
          <version>ooxml-3.7-20101029</version>
        </dependency>
        <dependency>
           <groupId>poi</groupId>
           <artifactId>poi</artifactId>
          <version>scratchpad-3.7-20101029</version>
        </dependency>
but when I build project, it build failure:
                              cannot access
org.apache.poi.poifs.filesystem.DirectoryNode
                                        class file for
org.apache.poi.poifs.filesystem.DirectoryNode not found
                                                        HWPFDocument
doc=new HWPFDocument(fis);

This is my function:

public String ReadDocToByte(String link)
    {

        //link="F:\\test.doc";
        byte []fileData=new byte[]{};

        WordExtractor ex=null;
        try
        {

            FileInputStream fis=new FileInputStream(link);
            HWPFDocument doc=new HWPFDocument(fis);

            fileData=doc.getDataStream();

        }

        catch (FileNotFoundException e)
        {

            e.printStackTrace();
        }
        catch (IOException e)
        {

            e.printStackTrace();
        }
        return fileData.toString();
    }


This function is used to read a doc file.

Please help me fix that error.
Thanks all,
BaoTram.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120305/06ff4b03/attachment.html 


More information about the sakai-dev mailing list