Package org.apache.poi.hwpf.model

Examples of org.apache.poi.hwpf.model.PicturesTable


    HWPFDocument docB = new HWPFDocument(new FileInputStream(docBFile));
   
    assertNotNull(docA.getPicturesTable());
    assertNotNull(docB.getPicturesTable());
   
    PicturesTable picA = docA.getPicturesTable();
    PicturesTable picB = docB.getPicturesTable();
   
    List picturesA = picA.getAllPictures();
    List picturesB = picB.getAllPictures();
   
    assertEquals(7, picturesA.size());
    assertEquals(2, picturesB.size());
  }
View Full Code Here


  /**
   * Test that we have the right images in at least one file
   */
  public void testImageData() throws Exception {
    HWPFDocument docB = new HWPFDocument(new FileInputStream(docBFile));
    PicturesTable picB = docB.getPicturesTable();
    List picturesB = picB.getAllPictures();
   
    assertEquals(2, picturesB.size());
   
    Picture pic1 = (Picture)picturesB.get(0);
    Picture pic2 = (Picture)picturesB.get(1);
View Full Code Here

  /**
   * Test that compressed image data is correctly returned.
   */
  public void testCompressedImageData() throws Exception {
    HWPFDocument docC = new HWPFDocument(new FileInputStream(docCFile));
    PicturesTable picC = docC.getPicturesTable();
    List picturesC = picC.getAllPictures();
   
    assertEquals(1, picturesC.size());
   
    Picture pic = (Picture)picturesC.get(0);
    assertNotNull(pic);
View Full Code Here

        HeaderStories headerFooter = new HeaderStories(document);

        // Grab the list of pictures. As far as we can tell,
        //  the pictures should be in order, and may be directly
        //  placed or referenced from an anchor
        PicturesTable pictureTable = document.getPicturesTable();
        PicturesSource pictures = new PicturesSource(document);

        // Do any headers, if present
        Range[] headers = new Range[] { headerFooter.getFirstHeaderSubrange(),
                headerFooter.getEvenHeaderSubrange(), headerFooter.getOddHeaderSubrange() };
View Full Code Here

    HWPFDocument docB = new HWPFDocument(new FileInputStream(docBFile));

    assertNotNull(docA.getPicturesTable());
    assertNotNull(docB.getPicturesTable());

    PicturesTable picA = docA.getPicturesTable();
    PicturesTable picB = docB.getPicturesTable();

    List picturesA = picA.getAllPictures();
    List picturesB = picB.getAllPictures();

    assertEquals(7, picturesA.size());
    assertEquals(2, picturesB.size());
  }
View Full Code Here

  /**
   * Test that we have the right images in at least one file
   */
  public void testImageData() throws Exception {
    HWPFDocument docB = new HWPFDocument(new FileInputStream(docBFile));
    PicturesTable picB = docB.getPicturesTable();
    List picturesB = picB.getAllPictures();

    assertEquals(2, picturesB.size());

    Picture pic1 = (Picture)picturesB.get(0);
    Picture pic2 = (Picture)picturesB.get(1);
View Full Code Here

  /**
   * Test that compressed image data is correctly returned.
   */
  public void testCompressedImageData() throws Exception {
    HWPFDocument docC = new HWPFDocument(new FileInputStream(docCFile));
    PicturesTable picC = docC.getPicturesTable();
    List picturesC = picC.getAllPictures();

    assertEquals(1, picturesC.size());

    Picture pic = (Picture)picturesC.get(0);
    assertNotNull(pic);
View Full Code Here

    {
        _dgg = new EscherRecordHolder();
    }

    // read in the pictures stream
    _pictures = new PicturesTable(this, _dataStream, _mainStream, _fspa, _dgg);
    // And the art shapes stream
    _officeArts = new ShapesTable(_tableStream, _fib);

    _st = new SectionTable(_mainStream, _tableStream, _fib.getFcPlcfsed(), _fib.getLcbPlcfsed(), fcMin, _tpt, _cpSplit);
    _ss = new StyleSheet(_tableStream, _fib.getFcStshf());
View Full Code Here

    {
        _escherRecordHolder = new EscherRecordHolder();
    }

    // read in the pictures stream
    _pictures = new PicturesTable(this, _dataStream, _mainStream, _fspaMain, _escherRecordHolder);
    // And the art shapes stream
    _officeArts = new ShapesTable(_tableStream, _fib);

    // And escher pictures
    _officeDrawingsHeaders = new OfficeDrawingsImpl( _fspaHeaders, _escherRecordHolder, _mainStream );
View Full Code Here

       //   file and an embeded word file, in that order
       HWPFDocument doc = HWPFTestDataSamples.openSampleFile("word_with_embeded.doc");
      
       // Check we don't break loading the pictures
       doc.getPicturesTable().getAllPictures();
       PicturesTable pictureTable = doc.getPicturesTable();
      
       // Check the text, and its embeded images
       Paragraph p;
       Range r = doc.getRange();
       assertEquals(1, r.numSections());
       assertEquals(5, r.numParagraphs());
      
       p = r.getParagraph(0);
       assertEquals(2, p.numCharacterRuns());
       assertEquals("I have lots of embedded files in me\r", p.text());
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
      
       p = r.getParagraph(1);
       assertEquals(5, p.numCharacterRuns());
       assertEquals("\u0013 EMBED Excel.Sheet.8  \u0014\u0001\u0015\r", p.text());
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
      
       p = r.getParagraph(2);
       assertEquals(6, p.numCharacterRuns());
       assertEquals("\u0013 EMBED Excel.Sheet.8  \u0014\u0001\u0015\r", p.text());
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(5)));
      
       p = r.getParagraph(3);
       assertEquals(6, p.numCharacterRuns());
       assertEquals("\u0013 EMBED PowerPoint.Show.8  \u0014\u0001\u0015\r", p.text());
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(5)));
      
       p = r.getParagraph(4);
       assertEquals(6, p.numCharacterRuns());
       assertEquals("\u0013 EMBED Word.Document.8 \\s \u0014\u0001\u0015\r", p.text());
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(0)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(1)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(2)));
       assertEquals(true,  pictureTable.hasPicture(p.getCharacterRun(3)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(4)));
       assertEquals(false, pictureTable.hasPicture(p.getCharacterRun(5)));

       // Look at the pictures table
       List<Picture> pictures = pictureTable.getAllPictures();
       assertEquals(4, pictures.size());

        Picture picture = pictures.get( 0 );
        assertEquals( "emf", picture.suggestFileExtension() );
        assertEquals( "0.emf", picture.suggestFullFileName() );
View Full Code Here

TOP

Related Classes of org.apache.poi.hwpf.model.PicturesTable

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.