HeadersFooters slideHeaderFooters = (officeParserConfig.getIncludeHeadersAndFooters()) ? slide.getHeadersFooters() : null; extractMaster(xhtml, slide.getMasterSheet()); textRunsToText(xhtml, slide.getTextParagraphs());
HSLFNotes notes = slide.getNotes(); if (notes == null) { return;
private void handleComments(HSLFSlide slide, XHTMLContentHandler xhtml) throws SAXException { if (slide.getComments() == null || slide.getComments().size() == 0) { return; for (Comment comment : slide.getComments()) { authorStringBuilder.setLength(0); xhtml.startElement("p", "class", "slide-comment");
/** * Background for this slide. */ @Override public HSLFBackground getBackground() { if (getFollowMasterBackground()) { final HSLFMasterSheet ms = getMasterSheet(); return (ms == null) ? null : ms.getBackground(); } return super.getBackground(); }
/** * Color scheme for this slide. */ @Override public ColorSchemeAtom getColorScheme() { if (getFollowMasterScheme()) { final HSLFMasterSheet ms = getMasterSheet(); return (ms == null) ? null : ms.getColorScheme(); } return super.getColorScheme(); }
@Override public String getSlideName() { final CString name = (CString)getSlideRecord().findFirstOfType(RecordTypes.CString.typeID); return name != null ? name.getText() : "Slide"+getSlideNumber(); }
HeadersFooters hf = slide.getHeadersFooters(); if (hf != null && hf.isHeaderVisible() && hf.getHeaderText() != null) { xhtml.startElement("p", "class", "slide-header"); extractMaster(xhtml, slide.getMasterSheet()); textRunsToText(xhtml, slide.getTextParagraphs()); for (HSLFShape shape : slide.getShapes()) { if (shape instanceof HSLFTable) { extractTableText(xhtml, (HSLFTable) shape); for (Comment comment : slide.getComments()) { authorStringBuilder.setLength(0); xhtml.startElement("p", "class", "slide-comment"); HSLFNotes notes = slide.getNotes(); if (notes != null) { xhtml.startElement("div", "class", "slide-notes"); HSLFNotes notes = slide.getNotes(); if (notes == null) { continue;
private static SlideMetadata processSlide(HSLFSlideShow rawSlideShow, HSLFSlide slide) { SlideMetadata slideMetadata = new SlideMetadata(); // process title String title = slide.getTitle(); slideMetadata.setTitle(title); // process notes slideMetadata.setNotes(collectText(slide.getNotes().getTextParagraphs(), title)); // process text slideMetadata.setText(collectText(slide.getTextParagraphs(), title)); // process thumbnail Dimension pgsize = rawSlideShow.getPageSize(); BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); // clear the drawing area graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); // render slide.draw(graphics); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); javax.imageio.ImageIO.write(img, "png", out); slideMetadata.setThumbnail(out.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } return slideMetadata; }
System.out.println("\nslide " + slide.getSlideNumber()); for (List<HSLFTextParagraph> paras : slide.getTextParagraphs()) { for (HSLFTextParagraph para : paras) { for (HSLFTextRun run : para) { for (HSLFShape sh : slide.getShapes()) { if (sh instanceof HSLFSimpleShape) { HSLFHyperlink link = ((HSLFSimpleShape) sh).getHyperlink();
/** * <p> * The title is a run of text of type <code>TextHeaderAtom.CENTER_TITLE_TYPE</code> or * <code>TextHeaderAtom.TITLE_TYPE</code> * </p> * * @see TextHeaderAtom */ @Override public String getTitle(){ for (List<HSLFTextParagraph> tp : getTextParagraphs()) { if (tp.isEmpty()) { continue; } int type = tp.get(0).getRunType(); switch (type) { case TextHeaderAtom.CENTER_TITLE_TYPE: case TextHeaderAtom.TITLE_TYPE: String str = HSLFTextParagraph.getRawText(tp); return HSLFTextParagraph.toExternalString(str, type); } } return null; }
if (slidenum != -1 && slidenum != slide.getSlideNumber()) { continue; String title = slide.getTitle(); System.out.println("Rendering slide "+slide.getSlideNumber() + (title == null ? "" : ": " + title)); slide.draw(graphics); String fname = file.replaceAll("\\.ppt", "-" + slide.getSlideNumber() + ".png"); FileOutputStream out = new FileOutputStream(fname); ImageIO.write(img, "png", out);
_notes.remove(removedSlide.getNotes()); sa.remove(index); s.setSlideNumber(i++); int notesId = removedSlide.getSlideRecord().getSlideAtom().getNotesID(); if (notesId != 0) { SlideListWithText nslwt = _documentRecord.getNotesSlideListWithText();
public static void main(String[] args) throws IOException { try (FileInputStream fis = new FileInputStream(args[0])) { try (HSLFSlideShow ppt = new HSLFSlideShow(fis)) { HSLFSoundData[] sounds = ppt.getSoundData(); for (HSLFSlide slide : ppt.getSlides()) { for (HSLFShape shape : slide.getShapes()) { int soundRef = getSoundReference(shape); if (soundRef == -1) continue; System.out.println("Slide[" + slide.getSlideNumber() + "], shape[" + shape.getShapeId() + "], soundRef: " + soundRef); System.out.println(" " + sounds[soundRef].getSoundName()); System.out.println(" " + sounds[soundRef].getSoundType()); } } } } }
@Override public boolean getDisplayPlaceholder(final Placeholder placeholder) { final HeadersFooters hf = getHeadersFooters(); final SlideLayoutType slt = getSlideRecord().getSlideAtom().getSSlideLayoutAtom().getGeometryType(); final boolean isTitle = (slt == SlideLayoutType.TITLE_SLIDE || slt == SlideLayoutType.TITLE_ONLY || slt == SlideLayoutType.MASTER_TITLE); switch (placeholder) { case DATETIME: return hf.isDateTimeVisible() && !isTitle; case SLIDE_NUMBER: return hf.isSlideNumberVisible() && !isTitle; case HEADER: return hf.isHeaderVisible() && !isTitle; case FOOTER: return hf.isFooterVisible() && !isTitle; default: return false; } }
@Override public HSLFMasterSheet getSlideLayout(){ // TODO: find out how we can find the mastersheet base on the slide layout type, i.e. // getSlideRecord().getSlideAtom().getSSlideLayoutAtom().getGeometryType() return getMasterSheet(); }
group.setAnchor(bounds); group.setInteriorAnchor(new Rectangle(0, 0, 100, 100)); slide.addShape(group); Graphics2D graphics = new PPGraphics2D(group);
for (HSLFSlide slide : ppt.getSlides()) { for (HSLFShape shape : slide.getShapes()) { if (shape instanceof HSLFObjectShape) { oleIdx++;
private static SlideMetadata processSlide(HSLFSlideShow rawSlideShow, HSLFSlide slide) { SlideMetadata slideMetadata = new SlideMetadata(); // process title String title = slide.getTitle(); slideMetadata.setTitle(title); // process notes slideMetadata.setNotes(collectText(slide.getNotes().getTextParagraphs(), title)); // process text slideMetadata.setText(collectText(slide.getTextParagraphs(), title)); // process thumbnail Dimension pgsize = rawSlideShow.getPageSize(); BufferedImage img = new BufferedImage(pgsize.width, pgsize.height, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = img.createGraphics(); // clear the drawing area graphics.setPaint(Color.white); graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height)); // render slide.draw(graphics); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); javax.imageio.ImageIO.write(img, "png", out); slideMetadata.setThumbnail(out.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } return slideMetadata; }
for (HSLFSlide slide : slides) { final ParserFieldsBuilder document = resultBuilder.newDocument(); final List<List<HSLFTextParagraph>> textLevel0 = slide.getTextParagraphs(); for (List<HSLFTextParagraph> textLevel1 : textLevel0) { for (HSLFTextParagraph textPara : textLevel1) {
/** * Create a <code>TextBox</code> object that represents the slide's title. * * @return <code>TextBox</code> object that represents the slide's title. */ public HSLFTextBox addTitle() { HSLFPlaceholder pl = new HSLFPlaceholder(); pl.setShapeType(ShapeType.RECT); pl.setPlaceholder(Placeholder.TITLE); pl.setRunType(TextHeaderAtom.TITLE_TYPE); pl.setText("Click to edit title"); pl.setAnchor(new java.awt.Rectangle(54, 48, 612, 90)); addShape(pl); return pl; }