Package org.apache.poi.hslf.model

Examples of org.apache.poi.hslf.model.TextBox


  public void testSetParagraphStyles() throws Exception {
    SlideShow ppt = new SlideShow();

    Slide slide = ppt.createSlide();

    TextBox shape = new TextBox();
    RichTextRun rt = shape.getTextRun().getRichTextRuns()[0];
    shape.setText(
        "Hello, World!\r" +
        "This should be\r" +
        "Multiline text");
    rt.setFontSize(42);
    rt.setBullet(true);
    rt.setTextOffset(50);
    rt.setBulletOffset(0);
    rt.setBulletChar('\u263A');
    slide.addShape(shape);

    assertEquals(42, rt.getFontSize());
    assertEquals(true, rt.isBullet());
    assertEquals(50, rt.getTextOffset());
    assertEquals(0, rt.getBulletOffset());
    assertEquals('\u263A', rt.getBulletChar());

    shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300));
    slide.addShape(shape);

    //serialize and read again
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ppt.write(out);
    out.close();

    ppt = new SlideShow(new ByteArrayInputStream(out.toByteArray()));
    slide = ppt.getSlides()[0];
    shape = (TextBox)slide.getShapes()[0];
    rt = shape.getTextRun().getRichTextRuns()[0];
    assertEquals(42, rt.getFontSize());
    assertEquals(true, rt.isBullet());
    assertEquals(50, rt.getTextOffset());
    assertEquals(0, rt.getBulletOffset());
    assertEquals('\u263A', rt.getBulletChar());
View Full Code Here


{
  public static void main(String[] args) throws Exception
  {
    SlideShow ppt = new SlideShow();
      Slide slide = ppt.createSlide();
      TextBox title = slide.addTitle();
      title.setText("Hello, World!");
     
      //save changes
      FileOutputStream out = new FileOutputStream("data/Apache_SlideTitle.ppt");
      ppt.write(out);
      out.close();
View Full Code Here

    line.setLineColor(new Color(0, 128, 0));
    line.setLineStyle(Line.LINE_DOUBLE);
    slide.addShape(line);
   
    // TextBox
    TextBox txt = new TextBox();
    txt.setText("Hello, World!");
    txt.setAnchor(new java.awt.Rectangle(300, 100, 300, 50));
   
    // use RichTextRun to work with the text format
    RichTextRun rt = txt.getTextRun().getRichTextRuns()[0];
    rt.setFontSize(32);
    rt.setFontName("Arial");
    rt.setBold(true);
    rt.setItalic(true);
    rt.setUnderlined(true);
View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.model.TextBox

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.