Java 类org.apache.poi.ss.usermodel.Header 实例源码

项目:openbd-core    文件:SpreadsheetSetHeader.java   
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();
Header header = sheet.getHeader();

header.setCenter( center );
header.setLeft( left );
header.setRight( right );

    return cfBooleanData.TRUE;
}
项目:Aspose_for_Apache_POI    文件:ApacheHeaderFooter.java   
public static void main(String[] args) throws Exception
{
    String dataPath = "src/featurescomparison/workingwithworksheets/headerandfooter/data/";

    Workbook wb = new HSSFWorkbook();
    Sheet sheet = wb.createSheet("new sheet");

    Header header = sheet.getHeader();
    header.setCenter("Center Header");
    header.setLeft("Left Header");
    header.setRight(HSSFHeader.font("Stencil-Normal", "Italic") +
                    HSSFHeader.fontSize((short) 16) + "Right w/ Stencil-Normal Italic font and size 16");

    FileOutputStream fileOut = new FileOutputStream(dataPath + "ApacheHeaderFooter_Out.xls");
    wb.write(fileOut);
    fileOut.close();

    System.out.println("Aspose Header Footer Created.");
}
项目:excella-pdfexporter    文件:ReportsTestUtil.java   
/**
 * ヘッダ情報の文字列表現を取得する。
 * 
 * @param header ヘッダ情報
 * @return ヘッダ情報の文字列表現
 */
private static String getHeaderString( Header header) {
    if ( header != null) {
        return "left=" + header.getLeft() + ",center=" + header.getCenter() + ",right=" + header.getRight();
    } else {
        return "";
    }
}
项目:excella-reports    文件:ReportsTestUtil.java   
/**
 * ヘッダ情報の文字列表現を取得する。
 * 
 * @param header ヘッダ情報
 * @return ヘッダ情報の文字列表現
 */
private static String getHeaderString( Header header) {
    if ( header != null) {
        return "left=" + header.getLeft() + ",center=" + header.getCenter() + ",right=" + header.getRight();
    } else {
        return "";
    }
}
项目:nextreports-engine    文件:XlsxExporter.java   
private void buildHeader() {        
    if (bean.getReportLayout().getPageHeaderBand().getColumnCount() == 0) {
        return;
    }
    try {           
        printPageHeaderBand();        
        Header header = xlsSheet.getHeader();           
        header.setCenter(headerS.toString());
    } catch (QueryException ex) {
        ex.printStackTrace();
    } finally {
        headerS = new StringBuilder();
    }
}
项目:nextreports-engine    文件:XlsExporter.java   
private void buildHeader() {        
    if (bean.getReportLayout().getPageHeaderBand().getColumnCount() == 0) {
        return;
    }
    try {           
        printPageHeaderBand();        
        Header header = xlsSheet.getHeader();           
        header.setCenter(headerS.toString());
    } catch (QueryException ex) {
        ex.printStackTrace();
    } finally {
        headerS = new StringBuilder();
    }
}
项目:OASIS-Maven    文件:ExcelFileReader.java   
public String getLeftHeader(){
    Header leftHeader = sheet.getHeader();
    return leftHeader.getLeft();
}
项目:OASIS-Maven    文件:ExcelFileReader.java   
public String getCenterHeader(){
    Header centerHeader = sheet.getHeader();
    return centerHeader.getCenter();
}
项目:OASIS-Maven    文件:ExcelFileReader.java   
public String getRightHeader(){
    Header rightHeader = sheet.getHeader();
    return rightHeader.getRight();
}
项目:birt    文件:FilteredSheet.java   
public Header getHeader() {
    return sheet.getHeader();
}
项目:excel-streaming-reader    文件:StreamingSheet.java   
/**
 * Not supported
 */
@Override
public Header getHeader() {
  throw new UnsupportedOperationException();
}
项目:egovframework.rte.root    文件:EgovExcelXSSFServiceTest.java   
/**
 * [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....");
    }
}