Package org.apache.poi.hslf.model

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


   
    final Shape[] shapes = s.getShapes();
    assertNotNull(shapes);
    assertEquals(3, shapes.length);
    assertTrue(shapes[2] instanceof Table);
    final Table table = (Table) shapes[2];
    assertEquals(4, table.getNumberOfColumns());
    assertEquals(6, table.getNumberOfRows());
    for (int x = 0; x < 4; x ++) {
      assertEquals("TH Cell " + (x + 1), table.getCell(0, x).getTextRun().getRawText());
      for (int y = 1; y < 6; y++) {
        assertEquals("Row " + y + ", Cell " + (x + 1), table.getCell(y, x).getText());
      }
    }
  }
View Full Code Here


   
    SlideShow ppt = new SlideShow();
   
    Slide slide = ppt.createSlide();
    // create a table of 5 rows and 2 columns
    Table table = new Table(5, 2);
    for (int i = 0; i < data.length; i++)
    {
      for (int j = 0; j < data[i].length; j++)
      {
        TableCell cell = table.getCell(i, j);
        cell.setText(data[i][j]);
   
        RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
        rt.setFontName("Arial");
        rt.setFontSize(10);
   
        cell.setVerticalAlignment(TextBox.AnchorMiddle);
        cell.setHorizontalAlignment(TextBox.AlignCenter);
      }
    }
   
    // set table borders
    Line border = table.createBorder();
    border.setLineColor(Color.black);
    border.setLineWidth(1.0);
    table.setAllBorders(border);
   
    // set width of the 1st column
    table.setColumnWidth(0, 300);
    // set width of the 2nd column
    table.setColumnWidth(1, 150);
   
    slide.addShape(table);
    table.moveTo(100, 100);
   
    FileOutputStream out = new FileOutputStream("data/Table_Apache.ppt");
    ppt.write(out);
    out.close();
  }
View Full Code Here

TOP

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

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.