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

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

Introduction

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

Prototype

void setLeft(String newLeft);

Source Link

Document

Sets the left 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 ww  w .j a v  a  2s .  c o m*/
                    }
                }
            }
        }
        if (!handledAsGrid) {
            poiHeaderFooter.setLeft(contentAsString(state, ftrObject));
        }
    }
}