@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; } } } } } if( ! handledAsGrid ) { poiHeaderFooter.setLeft( contentAsString( state, ftrObject ) ); } } }
private void extractHeaderFooter(final StringBuilder buffy, final HeaderFooter hf) { final String content = ExcelExtractor._extractHeaderFooter(hf); if (content.length() > 0) { buffy.append(content).append(' '); } }
/** * 复制页眉、页脚的文字信息 * * @author ZhengWei(HY) * @createDate 2017-06-22 * @version v1.0 * * @param i_FromHF * @param i_ToHF */ public final static void copyHeaderFooter(HeaderFooter i_FromHF ,HeaderFooter i_ToHF) { i_ToHF.setLeft( i_FromHF.getLeft()); i_ToHF.setCenter(i_FromHF.getCenter()); i_ToHF.setRight( i_FromHF.getRight()); }