TextBox<?,?> txt = _group.createTextBox(); TextRun rt = txt.getTextParagraphs().get(0).getTextRuns().get(0); rt.setFontSize((double)_font.getSize()); rt.setFontFamily(_font.getFamily());
public static void slide3(SlideShow<?,?> ppt) throws IOException { Slide<?,?> slide = ppt.createSlide(); TextBox<?,?> box1 = slide.createTextBox(); box1.setTextPlaceholder(TextPlaceholder.TITLE); box1.setText("HSLF in a Nutshell"); box1.setAnchor(new Rectangle(36, 15, 648, 65)); TextBox<?,?> box2 = slide.createTextBox(); box2.setTextPlaceholder(TextPlaceholder.BODY); box2.setText( "HSLF provides a way to read, create and modify MS PowerPoint presentations\r" + "Pure Java API - you don't need PowerPoint to read and write *.ppt files\r" + "Comprehensive support of PowerPoint objects\r" + "Rich text\r" + "Tables\r" + "Shapes\r" + "Pictures\r" + "Master slides\r" + "Access to low level data structures" ); List<? extends TextParagraph<?,?,?>> tp = box2.getTextParagraphs(); for (int i : new byte[]{0,1,2,8}) { tp.get(i).getTextRuns().get(0).setFontSize(28d); } for (int i : new byte[]{3,4,5,6,7}) { tp.get(i).getTextRuns().get(0).setFontSize(24d); tp.get(i).setIndentLevel(1); } box2.setAnchor(new Rectangle(36, 80, 648, 400)); }
public static void slide11(SlideShow<?,?> ppt) throws IOException { Slide<?,?> slide = ppt.createSlide(); TextBox<?,?> box1 = slide.createTextBox(); box1.setTextPlaceholder(TextPlaceholder.TITLE); box1.setText("HSLF Development Plans"); box1.setAnchor(new Rectangle(36, 21, 648, 90)); TextBox<?,?> box2 = slide.createTextBox(); box2.setTextPlaceholder(TextPlaceholder.BODY); box2.setText( "Support for more PowerPoint functionality\r" + "Rendering slides into java.awt.Graphics2D\r" + "A way to export slides into images or other formats\r" + "Integration with Apache FOP - Formatting Objects Processor\r" + "Transformation of XSL-FO into PPT\r" + "PPT2PDF transcoder" ); List<? extends TextParagraph<?,?,?>> tp = box2.getTextParagraphs(); for (int i : new byte[]{0,1,3}) { tp.get(i).getTextRuns().get(0).setFontSize(28d); } for (int i : new byte[]{2,4,5}) { tp.get(i).getTextRuns().get(0).setFontSize(24d); tp.get(i).setIndentLevel(1); } box2.setAnchor(new Rectangle(36, 126, 648, 400)); }
@Override public FieldType getFieldType() { HSLFTextShape ts = getTextParagraph().getParentShape(); Placeholder ph = ts.getPlaceholder(); if (ph != null) { switch (ph) { case SLIDE_NUMBER: return FieldType.SLIDE_NUMBER; case DATETIME: return FieldType.DATE_TIME; default: break; } } if (ts.getSheet() instanceof MasterSheet) { TextShape<?,? extends TextParagraph<?,?,? extends TextRun>> ms = ts.getMetroShape(); if (ms == null || ms.getTextParagraphs().isEmpty()) { return null; } List<? extends TextRun> trList = ms.getTextParagraphs().get(0).getTextRuns(); if (trList.isEmpty()) { return null; } return trList.get(0).getFieldType(); } return null; }
public static void slide1(SlideShow<?,?> ppt) throws IOException { Slide<?,?> slide = ppt.createSlide(); TextBox<?,?> box1 = slide.createTextBox(); box1.setTextPlaceholder(TextPlaceholder.CENTER_TITLE); box1.setText("POI-HSLF"); box1.setAnchor(new Rectangle(54, 78, 612, 115)); TextBox<?,?> box2 = slide.createTextBox(); box2.setTextPlaceholder(TextPlaceholder.CENTER_BODY); box2.setText("Java API To Access Microsoft PowerPoint Format Files"); box2.setAnchor(new Rectangle(108, 204, 504, 138)); TextBox<?,?> box3 = slide.createTextBox(); box3.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(32d); box3.setText( "Yegor Kozlov\r" + "yegor - apache - org"); box3.setHorizontalCentered(true); box3.setAnchor(new Rectangle(206, 348, 310, 84)); }
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d); box2.setText("Creating a simple presentation from scratch"); box2.setAnchor(new Rectangle(170, 100, 364, 30)); TextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0); rt3.setFontFamily("Courier New"); rt3.setFontSize(8d);
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d); box2.setText("PPGraphics2D: PowerPoint Graphics2D driver"); box2.setAnchor(new Rectangle(178, 70, 387, 30)); TextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0); rt3.setFontFamily("Courier New"); rt3.setFontSize(8d);
TableCell<?,?> cell = table1.getCell(i, j); cell.setText(txt1[i][j]); TextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0); rt.setFontSize(10d); rt.setFontFamily("Arial"); box1.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(24d); box1.setText("The source code is available at\r" + "http://people.apache.org/~yegor/apachecon_eu08/");
TextBox<?,?> txt = _group.createTextBox(); TextRun rt = txt.getTextParagraphs().get(0).getTextRuns().get(0); rt.setFontSize((double)_font.getSize()); rt.setFontFamily(_font.getFamily());