private boolean hasPicture(CharacterRun cr) { return picturesTable.hasPicture(cr); }
private PicturesSource(HWPFDocument doc) { picturesTable = doc.getPicturesTable(); all = picturesTable.getAllPictures(); // Build the Offset-Picture lookup map lookup = new HashMap<Integer, Picture>(); for (Picture p : all) { lookup.put(p.getStartOffset(), p); } // Work out which Pictures aren't referenced by // a \u0001 in the main text // These are \u0008 escher floating ones, ones // found outside the normal text, and who // knows what else... nonU1based = new ArrayList<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); } } }
if (pictures.hasPicture(cr)) { Picture picture = pictures.getFor(cr); handlePictureCharacterRun(cr, picture, pictures, xhtml);
/** * Does this run have a Picture in it? * * @see #getFor(CharacterRun) */ public boolean hasPicture(CharacterRun cr) { return picturesTable.hasPicture(cr); }
private boolean hasPicture(CharacterRun cr) { return picturesTable.hasPicture(cr); }
private boolean hasPicture(CharacterRun cr) { return picturesTable.hasPicture(cr); }
} else if (pictureTable.hasPicture(cr)) {
/** * Returns picture object tied to specified CharacterRun * @param run * @param fillBytes if true, Picture will be returned with filled byte array that represent picture's contents. If you don't want * to have that byte array in memory but only write picture's contents to stream, pass false and then use Picture.writeImageContent * @see Picture#writeImageContent(java.io.OutputStream) * @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; }
/** * Returns picture object tied to specified CharacterRun * @param run * @param fillBytes if true, Picture will be returned with filled byte array that represent picture's contents. If you don't want * to have that byte array in memory but only write picture's contents to stream, pass false and then use Picture.writeImageContent * @see Picture#writeImageContent(java.io.OutputStream) * @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; }
private PicturesSource(HWPFDocument doc) { picturesTable = doc.getPicturesTable(); all = picturesTable.getAllPictures(); // Build the Offset-Picture lookup map lookup = new HashMap<Integer, Picture>(); for (Picture p : all) { lookup.put(p.getStartOffset(), p); } // Work out which Pictures aren't referenced by // a \u0001 in the main text // These are \u0008 escher floating ones, ones // found outside the normal text, and who // knows what else... nonU1based = new ArrayList<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); } } }
public PictureRunMapper(HWPFDocument doc) { picturesTable = doc.getPicturesTable(); all = picturesTable.getAllPictures(); // Build the Offset-Picture lookup map lookup = new HashMap<>(); for (Picture p : all) { lookup.put(p.getStartOffset(), p); } // Work out which Pictures aren't referenced by // a \u0001 in the main text // These are \u0008 escher floating ones, ones // found outside the normal text, and who // knows what else... nonU1based = new ArrayList<>(); 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); } } }
private PicturesSource(HWPFDocument doc) { picturesTable = doc.getPicturesTable(); all = picturesTable.getAllPictures(); // Build the Offset-Picture lookup map lookup = new HashMap<Integer, Picture>(); for (Picture p : all) { lookup.put(p.getStartOffset(), p); } // Work out which Pictures aren't referenced by // a \u0001 in the main text // These are \u0008 escher floating ones, ones // found outside the normal text, and who // knows what else... nonU1based = new ArrayList<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); } } }
PicturesTable pictureTable = document.getPicturesTable(); Range r = document.getRange(); for(int i=0; i<r.numParagraphs(); i++) { Paragraph p = r.getParagraph(i); for(int j=0; j<p.numCharacterRuns(); j++) { CharacterRun cr = p.getCharacterRun(j); if (pictureTable.hasPicture(cr)) { Picture picture = pictures.getFor(cr); // Do something useful with the picture } } }
if (pictures.hasPicture(cr)) { Picture picture = pictures.getFor(cr); handlePictureCharacterRun(cr, picture, pictures, xhtml);
if (pictures.hasPicture(cr)) { Picture picture = pictures.getFor(cr); handlePictureCharacterRun(cr, picture, pictures, xhtml);
.hasPicture( characterRun ) )
.hasPicture( characterRun ) )
} else if (pictureTable.hasPicture(cr)) {
} else if (pictureTable.hasPicture(cr)) {