Example usage for org.apache.poi.hssf.usermodel HSSFSimpleShape OBJECT_TYPE_RECTANGLE

List of usage examples for org.apache.poi.hssf.usermodel HSSFSimpleShape OBJECT_TYPE_RECTANGLE

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFSimpleShape OBJECT_TYPE_RECTANGLE.

Prototype

short OBJECT_TYPE_RECTANGLE

To view the source code for org.apache.poi.hssf.usermodel HSSFSimpleShape OBJECT_TYPE_RECTANGLE.

Click Source Link

Usage

From source file:poi.hssf.usermodel.examples.OfficeDrawing.java

License:Apache License

private static void drawSheet1(HSSFSheet sheet1) {
    // Create a row and size one of the cells reasonably large.
    HSSFRow row = sheet1.createRow(2);/*  w w  w.  j ava  2  s . c  om*/
    row.setHeight((short) 2800);
    row.createCell(1);
    sheet1.setColumnWidth(2, 9000);

    // Create the drawing patriarch.  This is the top level container for
    // all shapes.
    HSSFPatriarch patriarch = sheet1.createDrawingPatriarch();

    // Draw some lines and an oval.
    drawLinesToCenter(patriarch);
    drawManyLines(patriarch);
    drawOval(patriarch);
    drawPolygon(patriarch);

    // Draw a rectangle.
    HSSFSimpleShape rect = patriarch
            .createSimpleShape(new HSSFClientAnchor(100, 100, 900, 200, (short) 0, 0, (short) 0, 0));
    rect.setShapeType(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE);
}