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

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

Introduction

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

Prototype

void setRight(String newRight);

Source Link

Document

Sets the right string or footer.

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 av  a 2 s  .  c o  m
                    }
                }
            }
        }
        if (!handledAsGrid) {
            poiHeaderFooter.setLeft(contentAsString(state, ftrObject));
        }
    }
}