use of org.apache.poi.sl.usermodel.TableShape in project poi by apache.
the class TestTable method testTextDirection.
private void testTextDirection(SlideShow<?, ?> ppt1) throws IOException {
TextDirection[] tds = { TextDirection.HORIZONTAL, TextDirection.VERTICAL, TextDirection.VERTICAL_270 };
TableShape<?, ?> tbl1 = ppt1.createSlide().createTable(1, 3);
tbl1.setAnchor(new Rectangle2D.Double(50, 50, 200, 200));
int col = 0;
for (TextDirection td : tds) {
TableCell<?, ?> c = tbl1.getCell(0, col++);
if (c != null) {
c.setTextDirection(td);
c.setText("bla");
}
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ppt1.write(bos);
ppt1.close();
InputStream is = new ByteArrayInputStream(bos.toByteArray());
SlideShow<?, ?> ppt2 = SlideShowFactory.create(is);
TableShape<?, ?> tbl2 = (TableShape<?, ?>) ppt2.getSlides().get(0).getShapes().get(0);
col = 0;
for (TextDirection td : tds) {
TableCell<?, ?> c = tbl2.getCell(0, col++);
assertEquals(td, c.getTextDirection());
}
ppt2.close();
}
Aggregations