Package org.apache.poi.poifs.filesystem

Examples of org.apache.poi.poifs.filesystem.DirectoryNode


    String filename = pdirname + "/excel_with_embeded.xls";
    POIFSFileSystem fs = new POIFSFileSystem(
        new FileInputStream(filename)
    );
   
      DirectoryNode dirA = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B5");
    DirectoryNode dirB = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B4");
   
    HSSFWorkbook wbA = new HSSFWorkbook(dirA, fs, true);
    HSSFWorkbook wbB = new HSSFWorkbook(dirB, fs, true);
   
View Full Code Here


    public void testExtractFromEmbeded() throws Exception {
      POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filename3));
      HWPFDocument doc;
      WordExtractor extractor3;
     
      DirectoryNode dirA = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B7");
      DirectoryNode dirB = (DirectoryNode)
        fs.getRoot().getEntry("MBD0000A3B2");
     
      // Should have WordDocument and 1Table
      assertNotNull(dirA.getEntry("1Table"));
      assertNotNull(dirA.getEntry("WordDocument"));
     
      assertNotNull(dirB.getEntry("1Table"));
      assertNotNull(dirB.getEntry("WordDocument"));
     
      // Check each in turn
      doc = new HWPFDocument(dirA, fs);
      extractor3 = new WordExtractor(doc);
   
View Full Code Here

      POIFSFileSystem fs = new POIFSFileSystem(
          new FileInputStream(filename3)
      );
      HSLFSlideShow ss;
     
      DirectoryNode dirA = (DirectoryNode)
        fs.getRoot().getEntry("MBD0000A3B6");
    DirectoryNode dirB = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B3");
   
    assertNotNull(dirA.getEntry("PowerPoint Document"));
    assertNotNull(dirB.getEntry("PowerPoint Document"));
     
    // Check the first file
      ss = new HSLFSlideShow(dirA, fs);
    ppe = new PowerPointExtractor(ss);
    assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
View Full Code Here

      POIFSFileSystem fs = new POIFSFileSystem(
          new FileInputStream(filename3)
      );
      HSLFSlideShow ss;
     
      DirectoryNode dirA = (DirectoryNode)
        fs.getRoot().getEntry("MBD0000A3B6");
    DirectoryNode dirB = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B3");
   
    assertNotNull(dirA.getEntry("PowerPoint Document"));
    assertNotNull(dirB.getEntry("PowerPoint Document"));
     
    // Check the first file
      ss = new HSLFSlideShow(dirA, fs);
    ppe = new PowerPointExtractor(ss);
    assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
View Full Code Here

    protected boolean processOle2( HWPFDocument wordDocument, Element block,
            Entry entry ) throws Exception
    {
        if ( !( entry instanceof DirectoryNode ) )
            return false;
        DirectoryNode directoryNode = (DirectoryNode) entry;

        /*
         * even if there is no ExtractorFactory in classpath, still support
         * included Word's objects
         */
        if ( directoryNode.hasEntry( "WordDocument" ) )
        {
            String text = WordToTextConverter.getText( (DirectoryNode) entry );
            block.appendChild( textDocumentFacade
                    .createText( UNICODECHAR_ZERO_WIDTH_SPACE + text
                            + UNICODECHAR_ZERO_WIDTH_SPACE ) );
View Full Code Here

      return olemap;
    }
   
    public int addOlePackage(POIFSFileSystem poiData, String label, String fileName, String command)
    throws IOException {
      DirectoryNode root = poiData.getRoot();
      Map<String,ClassID> olemap = getOleMap();
      for (Map.Entry<String,ClassID> entry : olemap.entrySet()) {
        if (root.hasEntry(entry.getKey())) {
          root.setStorageClsid(entry.getValue());
          break;
        }
      }
     
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
View Full Code Here

              for (int i = 0; i < objects.size(); i++) {
                 HSSFObjectData embeddedObject = objects.get(i);
                 if (embeddedObject.hasDirectoryEntry()) {
                    DirectoryEntry dir = embeddedObject.getDirectory();
                    if (dir instanceof DirectoryNode) {
                       DirectoryNode dNode = (DirectoryNode)dir;
                       if (hasEntry(dNode,"WordDocument")) {
                          found = true;
                       }
                    }
                 }
View Full Code Here

         POIFSFileSystem fs = new POIFSFileSystem(
             POIDataSamples.getSpreadSheetInstance().openResourceAsStream("excel_with_embeded.xls")
         );
         HSLFSlideShow ss;

         DirectoryNode dirA = (DirectoryNode)
             fs.getRoot().getEntry("MBD0000A3B6");
         DirectoryNode dirB = (DirectoryNode)
             fs.getRoot().getEntry("MBD0000A3B3");

         assertNotNull(dirA.getEntry("PowerPoint Document"));
         assertNotNull(dirB.getEntry("PowerPoint Document"));

         // Check the first file
         ss = new HSLFSlideShow(dirA);
         ppe = new PowerPointExtractor(ss);
         assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
View Full Code Here

  public void testWithEmbeded() throws Exception {
    POIFSFileSystem fs = new POIFSFileSystem(
      POIDataSamples.getDocumentInstance().openResourceAsStream("word_with_embeded.doc")
    );

    DirectoryNode objPool = (DirectoryNode) fs.getRoot().getEntry("ObjectPool");
    DirectoryNode dirA = (DirectoryNode) objPool.getEntry("_1269427460");
    DirectoryNode dirB = (DirectoryNode) objPool.getEntry("_1269427461");

    HSSFWorkbook wbA = new HSSFWorkbook(dirA, fs, true);
    HSSFWorkbook wbB = new HSSFWorkbook(dirB, fs, true);

    ExcelExtractor exA = new ExcelExtractor(wbA);
View Full Code Here

    POIDataSamples ssSamples = POIDataSamples.getSpreadSheetInstance();
    POIFSFileSystem fs = new POIFSFileSystem(
        ssSamples.openResourceAsStream("excel_with_embeded.xls")
    );

    DirectoryNode dirA = (DirectoryNode) fs.getRoot().getEntry("MBD0000A3B5");
    DirectoryNode dirB = (DirectoryNode) fs.getRoot().getEntry("MBD0000A3B4");

    HSSFWorkbook wbA = new HSSFWorkbook(dirA, fs, true);
    HSSFWorkbook wbB = new HSSFWorkbook(dirB, fs, true);

    ExcelExtractor exA = new ExcelExtractor(wbA);
View Full Code Here

TOP

Related Classes of org.apache.poi.poifs.filesystem.DirectoryNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.