Examples of Picture


Examples of org.apache.poi.hwpf.usermodel.Picture

             j += handleSpecialCharacterRuns(p, j, tas.isHeading(), pictures, xhtml);
          } else if(cr.text().startsWith("\u0008")) {
             // Floating Picture(s)
             for(int pn=0; pn<cr.text().length(); pn++) {
                // Assume they're in the order from the unclaimed list...
                Picture picture = pictures.nextUnclaimed();
               
                // Output
                handlePictureCharacterRun(cr, picture, pictures, xhtml);
             }
          } else if(pictureTable.hasPicture(cr)) {
             // Inline Picture
             Picture picture = pictures.getFor(cr);
             handlePictureCharacterRun(cr, picture, pictures, xhtml);
          } else {
             handleCharacterRun(cr, tas.isHeading(), xhtml);
          }
       }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

             xhtml.endElement("a");
          } else {
             // Just output the text ones
             for(CharacterRun cr : texts) {
                if(pictures.hasPicture(cr)) {
                   Picture picture = pictures.getFor(cr);
                   handlePictureCharacterRun(cr, picture, pictures, xhtml);
                } else {
                   handleCharacterRun(cr, skipStyling, xhtml);
                }
             }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

          nonU1based.addAll(all);
          Range r = doc.getRange();
          for(int i=0; i<r.numCharacterRuns(); i++) {
             CharacterRun cr = r.getCharacterRun(i);
             if(picturesTable.hasPicture(cr)) {
                Picture p = getFor(cr);
                int at = nonU1based.indexOf(p);
                nonU1based.set(at, null);
             }
          }
       }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

       /**
        * Return the next unclaimed one, used towards
        *  the end
        */
       private Picture nextUnclaimed() {
          Picture p = null;
          while(pn < nonU1based.size()) {
             p = nonU1based.get(pn);
             pn++;
             if(p != null) return p;
          }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

    PicturesTable picB = docB.getPicturesTable();
    List picturesB = picB.getAllPictures();

    assertEquals(2, picturesB.size());

    Picture pic1 = (Picture)picturesB.get(0);
    Picture pic2 = (Picture)picturesB.get(1);

    assertNotNull(pic1);
    assertNotNull(pic2);

    // Check the same
    byte[] pic1B = readFile(imgAFile);
    byte[] pic2B = readFile(imgBFile);

    assertEquals(pic1B.length, pic1.getContent().length);
    assertEquals(pic2B.length, pic2.getContent().length);

    assertBytesSame(pic1B, pic1.getContent());
    assertBytesSame(pic2B, pic2.getContent());
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

    PicturesTable picC = docC.getPicturesTable();
    List picturesC = picC.getAllPictures();

    assertEquals(1, picturesC.size());

    Picture pic = (Picture)picturesC.get(0);
    assertNotNull(pic);

    // Check the same
    byte[] picBytes = readFile(imgCFile);

    assertEquals(picBytes.length, pic.getContent().length);
    assertBytesSame(picBytes, pic.getContent());
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

        HWPFDocument docD = new HWPFDocument(new FileInputStream(docDFile));
        List allPictures = docD.getPicturesTable().getAllPictures();

        assertEquals(1, allPictures.size());

        Picture pic = (Picture) allPictures.get(0);
        assertNotNull(pic);
        byte[] picD = readFile(imgDFile);

        assertEquals(picD.length, pic.getContent().length);

        assertBytesSame(picD, pic.getContent());
    }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

   * @return a Picture object if picture exists for specified CharacterRun, null otherwise. PicturesTable.hasPicture is used to determine this.
   * @see #hasPicture(org.apache.poi.hwpf.usermodel.CharacterRun)
   */
  public Picture extractPicture(CharacterRun run, boolean fillBytes) {
    if (hasPicture(run)) {
      return new Picture(run.getPicOffset(), _dataStream, fillBytes);
    }
    return null;
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

                {
                    EscherBSERecord bse = (EscherBSERecord) escherRecord;
                    EscherBlipRecord blip = bse.getBlipRecord();
                    if (blip != null)
                    {
                        pictures.add(new Picture(blip.getPicturedata()));
                    }
                    else if (bse.getOffset() > 0)
                    {
                        // Blip stored in delay stream, which in a word doc, is the main stream
                        EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
                        blip = (EscherBlipRecord) recordFactory.createRecord(_mainStream, bse.getOffset());
                        blip.fillFields(_mainStream, bse.getOffset(), recordFactory);
                        pictures.add(new Picture(blip.getPicturedata()));
                    }
                }

                // Recursive call.
                searchForPictures(escherRecord.getChildRecords(), pictures);
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

    Range range = _document.getRange();
    for (int i = 0; i < range.numCharacterRuns(); i++) {
      CharacterRun run = range.getCharacterRun(i);
      String text = run.text();
      Picture picture = extractPicture(run, false);
      if (picture != null) {
        pictures.add(picture);
      }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.