Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.Header


        //&P == current page number
        //&N == page numbers
        footer.setRight("Page &P of &N");

       
        Header firstHeader=((XSSFSheet)sheet).getFirstHeader();
        //&F == workbook file name
        firstHeader.setLeft("&F ......... first header");
       
        for(int i=0;i<100;i=i+10){
            sheet.createRow(i).createCell(0).setCellValue(123);
        }
       
       
        XSSFSheet sheet2 = (XSSFSheet)wb.createSheet("odd header-even footer");
        Header oddHeader=sheet2.getOddHeader();
        //&B == bold
        //&E == double underline
        //&D == date
        oddHeader.setCenter("&B &E oddHeader     &D ");
       
        Footer evenFooter=sheet2.getEvenFooter();
        evenFooter.setRight("even footer &P");
        sheet2.createRow(10).createCell(0).setCellValue("Second sheet with an oddHeader and an evenFooter");

        for(int i=0;i<200;i=i+10){
            sheet2.createRow(i).createCell(0).setCellValue(123);
        }
       
        XSSFSheet sheet3 = (XSSFSheet)wb.createSheet("odd header- odd footer");
        sheet3.createRow(10).createCell(0).setCellValue("Third sheet with oddHeader and oddFooter");
        Header oddH=sheet3.getOddHeader();
        //&C == centered
        oddH.setCenter("centered oddHeader");
        oddH.setLeft("left ");
        oddH.setRight("right ");
       
        Footer oddF=sheet3.getOddFooter();
        oddF.setLeft("Page &P");
        oddF.setRight("Pages &N ");
       
View Full Code Here


  public static void main(String[] args) throws Exception
  {
    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("data/ApacheHeaderFooter.xls");
      wb.write(fileOut);
      fileOut.close();
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.Header

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.