Example usage for org.apache.poi.ss.usermodel HeaderFooter setCenter

List of usage examples for org.apache.poi.ss.usermodel HeaderFooter setCenter

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel HeaderFooter setCenter.

Prototype

void setCenter(String newCenter);

Source Link

Document

Sets the center string.

Usage

From source file:uk.co.spudsoft.birt.emitters.excel.handlers.PageHandler.java

License:Open Source License

@SuppressWarnings("rawtypes")
private void processHeaderFooter(HandlerState state, Collection birtHeaderFooter, HeaderFooter poiHeaderFooter)
        throws BirtException {
    boolean handledAsGrid = false;
    for (Object ftrObject : birtHeaderFooter) {
        if (ftrObject instanceof ITableContent) {
            ITableContent ftrTable = (ITableContent) ftrObject;
            if (ftrTable.getChildren().size() == 1) {
                Object child = ftrTable.getChildren().toArray()[0];
                if (child instanceof IRowContent) {
                    IRowContent row = (IRowContent) child;
                    if (ftrTable.getColumnCount() <= 3) {
                        Object[] cellObjects = row.getChildren().toArray();
                        if (ftrTable.getColumnCount() == 1) {
                            poiHeaderFooter.setLeft(contentAsString(state, cellObjects[0]));
                            handledAsGrid = true;
                        } else if (ftrTable.getColumnCount() == 2) {
                            poiHeaderFooter.setLeft(contentAsString(state, cellObjects[0]));
                            poiHeaderFooter.setRight(contentAsString(state, cellObjects[1]));
                            handledAsGrid = true;
                        } else if (ftrTable.getColumnCount() == 3) {
                            poiHeaderFooter.setLeft(contentAsString(state, cellObjects[0]));
                            poiHeaderFooter.setCenter(contentAsString(state, cellObjects[1]));
                            poiHeaderFooter.setRight(contentAsString(state, cellObjects[2]));
                            handledAsGrid = true;
                        }/*from  w  w w  .j  a  va 2  s . co m*/
                    }
                }
            }
        }
        if (!handledAsGrid) {
            poiHeaderFooter.setLeft(contentAsString(state, ftrObject));
        }
    }
}