public cfData execute( cfSession _session, List<cfData> parameters ) throws cfmRunTimeException { cfSpreadSheetData spreadsheet = null; String left, center, right; /* * Collect up the parameters */ spreadsheet = (cfSpreadSheetData)parameters.get(3); left = parameters.get(2).getString(); center = parameters.get(1).getString(); right = parameters.get(0).getString(); /* * Perform the insertion */ Sheet sheet = spreadsheet.getActiveSheet(); Footer footer = sheet.getFooter(); footer.setCenter( center ); footer.setLeft( left ); footer.setRight( right ); return cfBooleanData.TRUE; }
protected void initFooter(Sheet sheet, Date exportDateTime) { Footer footer = sheet.getFooter(); // add a fixed export date and time (not a dynamic HeaderFooter.date() ) SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); footer.setLeft(dateFormat.format(exportDateTime)); footer.setRight("Page " + HeaderFooter.page() + " of " + HeaderFooter.numPages()); }
/** * @param footer * @return */ private static String getFooterString( Footer footer) { if ( footer != null) { return "left=" + footer.getLeft() + ",center=" + footer.getCenter() + ",right=" + footer.getRight(); } else { return ""; } }
private void buildFooter() { if (bean.getReportLayout().getPageFooterBand().getColumnCount() == 0) { return; } try { printPageFooterBand(); Footer footer = xlsSheet.getFooter(); footer.setCenter(footerS.toString()); } catch (QueryException ex) { ex.printStackTrace(); } finally { footerS = new StringBuilder(); } }
public String getLeftFooter(){ Footer leftFooter = sheet.getFooter(); return leftFooter.getLeft(); }
public String getCenterFooter(){ Footer centerFooter = sheet.getFooter(); return centerFooter.getCenter(); }
public String getRightFooter(){ Footer rightFooter = sheet.getFooter(); return rightFooter.getRight(); }
public Footer getFooter() { return sheet.getFooter(); }
/** * Not supported */ @Override public Footer getFooter() { throw new UnsupportedOperationException(); }
/** * [Flow #-4] 엑셀 문서 속성 수정 : 엑셀 파일 문서의 속성(Header, Footer)을 수정함 */ @Test public void testModifyDocAttribute() throws Exception { try { log.debug("testModifyDocAttribute start...."); StringBuffer sb = new StringBuffer(); sb.append(fileLocation).append("/").append("testModifyDocAttribute.xlsx"); if (EgovFileUtil.isExistsFile(sb.toString())) { EgovFileUtil.delete(new File(sb.toString())); log.debug("Delete file...." + sb.toString()); } XSSFWorkbook wbTmp = new XSSFWorkbook(); wbTmp.createSheet(); // 엑셀 파일 생성 excelService.createXSSFWorkbook(wbTmp, sb.toString()); // 엑셀 파일 로드 XSSFWorkbook wb = excelService.loadXSSFWorkbook(sb.toString()); log.debug("testModifyCellContents after loadWorkbook...."); XSSFSheet sheet = wb.createSheet("doc test sheet"); XSSFRow row = sheet.createRow(1); XSSFCell cell = row.createCell(1); cell.setCellValue(new XSSFRichTextString("Header/Footer Test")); // Header XSSFOddHeader header = (XSSFOddHeader) sheet.getHeader(); header.setCenter("Center Header"); header.setLeft("Left Header"); header.setRight(XSSFOddHeader.stripFields("&IRight Stencil-Normal Italic font and size 16")); // Footer XSSFOddHeader footer = (XSSFOddHeader) sheet.getFooter(); footer.setCenter(XSSFOddHeader.stripFields("Fixedsys")); log.debug("Style is ... " + XSSFOddHeader.stripFields("Fixedsys")); footer.setLeft("Left Footer"); footer.setRight("Right Footer"); // 엑셀 파일 저장 FileOutputStream out = new FileOutputStream(sb.toString()); wb.write(out); out.close(); assertTrue(EgovFileUtil.isExistsFile(sb.toString())); ////////////////////////////////////////////////////////////////////////// // 검증 XSSFWorkbook wbT = excelService.loadXSSFWorkbook(sb.toString()); XSSFSheet sheetT = wbT.getSheet("doc test sheet"); Header headerT = sheetT.getHeader(); assertEquals("Center Header", headerT.getCenter()); assertEquals("Left Header", headerT.getLeft()); assertEquals(XSSFOddHeader.stripFields("Right Stencil-Normal Italic font and size 16"), headerT.getRight()); Footer footerT = sheetT.getFooter(); assertEquals("Right Footer", footerT.getRight()); assertEquals("Left Footer", footerT.getLeft()); assertEquals(XSSFOddHeader.stripFields("Fixedsys"), footerT.getCenter()); } catch (Exception e) { log.error(e.toString()); throw new Exception(e); } finally { log.debug("testModifyDocAttribute end...."); } }