Package org.apache.poi.hssf.usermodel

Examples of org.apache.poi.hssf.usermodel.HSSFPrintSetup


   
    // PageSettingBlock in this file contains PLS (sid=x004D) record
    // followed by ContinueRecord (sid=x003C) 
    HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex46548-23133.xls");
    HSSFSheet sheet = wb.getSheetAt(0);
    HSSFPrintSetup ps = sheet.getPrintSetup();
   
    try {
      ps.getCopies();
    } catch (NullPointerException e) {
      e.printStackTrace();
      throw new AssertionFailedError("Identified bug 46548: PageSettingBlock missing PrintSetupRecord record");
    }
  }
View Full Code Here


        wb.setPrintArea(0, 0, colCount, 0, rowCount);
        HSSFFooter footer = sheet.getFooter();
        footer.setCenter("Page " + HSSFFooter.page() + " of " + HSSFFooter.numPages());
        // Fit Sheet to 1 page wide but very long
        sheet.setAutobreaks(true);
        HSSFPrintSetup ps = sheet.getPrintSetup();
        ps.setFitWidth((short)1);
        ps.setFitHeight((short)9999);
        sheet.setGridsPrinted(true);
        sheet.setHorizontallyCenter(true);
        ps.setPaperSize(HSSFPrintSetup.LETTER_PAPERSIZE);
        if(colCount > 5){ps.setLandscape(true);}
        if(colCount > 10){ps.setPaperSize(HSSFPrintSetup.LEGAL_PAPERSIZE);}
        if(colCount > 14){ps.setPaperSize(HSSFPrintSetup.EXECUTIVE_PAPERSIZE);}
        // Set Margins
        ps.setHeaderMargin((double) .35);
        ps.setFooterMargin((double) .35);
        sheet.setMargin(HSSFSheet.TopMargin, (double) .50);
        sheet.setMargin(HSSFSheet.BottomMargin, (double) .50);
        sheet.setMargin(HSSFSheet.LeftMargin, (double) .50);
        sheet.setMargin(HSSFSheet.RightMargin, (double) .50);
       
View Full Code Here

    // PageSettingBlock in this file contains PLS (sid=x004D) record
    // followed by ContinueRecord (sid=x003C)
    HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex46548-23133.xls");
    HSSFSheet sheet = wb.getSheetAt(0);
    HSSFPrintSetup ps = sheet.getPrintSetup();

    try {
      ps.getCopies();
    } catch (NullPointerException e) {
      e.printStackTrace();
      throw new AssertionFailedError("Identified bug 46548: PageSettingBlock missing PrintSetupRecord record");
    }
  }
View Full Code Here

   
    // PageSettingBlock in this file contains PLS (sid=x004D) record
    // followed by ContinueRecord (sid=x003C) 
    HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex46548-23133.xls");
    HSSFSheet sheet = wb.getSheetAt(0);
    HSSFPrintSetup ps = sheet.getPrintSetup();
   
    try {
      ps.getCopies();
    } catch (NullPointerException e) {
      e.printStackTrace();
      throw new AssertionFailedError("Identified bug 46548: PageSettingBlock missing PrintSetupRecord record");
    }
  }
View Full Code Here

    // PageSettingBlock in this file contains PLS (sid=x004D) record
    // followed by ContinueRecord (sid=x003C)
    HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex46548-23133.xls");
    HSSFSheet sheet = wb.getSheetAt(0);
    HSSFPrintSetup ps = sheet.getPrintSetup();

    try {
      ps.getCopies();
    } catch (NullPointerException e) {
      e.printStackTrace();
      throw new AssertionFailedError("Identified bug 46548: PageSettingBlock missing PrintSetupRecord record");
    }
  }
View Full Code Here

    s.setFitToPage(sheet.isFitToPage());
    s.setHorizontallyCenter(sheet.isHorizontallyCenter());
    s.setAutobreaks(true);

    // Print Config
    HSSFPrintSetup printSetup = s.getPrintSetup();
    printSetup.setLandscape(sheet.isLandscape());
    printSetup.setFitHeight((short) 1);
    printSetup.setFitWidth((short) 1);

    // Rows
    int rowNum = 0;

    for (Row row : sheet.getRows()) {
View Full Code Here

        /**
         * Print setup
         */
        xlsSheet.autoSizeColumn((short) 0);

        HSSFPrintSetup printSetup = xlsSheet.getPrintSetup();

        printSetup.setHResolution(sheetResolution);
        printSetup.setVResolution(sheetResolution);
        printSetup.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
        printSetup.setLandscape(orientation != null && orientation.equalsIgnoreCase("landscape"));
        workbook.setPrintArea(workbook.getSheetIndex(xlsSheet), printAreaColumnStart, printAreaColumnEnd, printAreaRowStart, printAreaRowEnd);
        xlsSheet.setAutobreaks(true);
        printSetup.setFitWidth((short) 1);
        printSetup.setFitHeight((short) 0);
        printSetup.setHeaderMargin(0.1d);

        for (int i = 0; i < modelSheet.getRowBreaks().length; i++) {
            xlsSheet.setRowBreak(modelSheet.getRowBreaks()[i]);
        }

View Full Code Here

    // PageSettingBlock in this file contains PLS (sid=x004D) record
    // followed by ContinueRecord (sid=x003C)
    HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex46548-23133.xls");
    HSSFSheet sheet = wb.getSheetAt(0);
    HSSFPrintSetup ps = sheet.getPrintSetup();

    try {
      ps.getCopies();
    } catch (NullPointerException e) {
      e.printStackTrace();
      throw new AssertionFailedError("Identified bug 46548: PageSettingBlock missing PrintSetupRecord record");
    }
  }
View Full Code Here

    s.setFitToPage(sheet.isFitToPage());
    s.setHorizontallyCenter(sheet.isHorizontallyCenter());
    s.setAutobreaks(true);

    // Print Config
    HSSFPrintSetup printSetup = s.getPrintSetup();
    printSetup.setLandscape(sheet.isLandscape());
    printSetup.setFitHeight((short) 1);
    printSetup.setFitWidth((short) 1);

    // Rows
    int rowNum = 0;

    for (Row row : sheet.getRows()) {
View Full Code Here

    s.setFitToPage(sheet.isFitToPage());
    s.setHorizontallyCenter(sheet.isHorizontallyCenter());
    s.setAutobreaks(true);

    // Print Config
    HSSFPrintSetup printSetup = s.getPrintSetup();
    printSetup.setLandscape(sheet.isLandscape());
    printSetup.setFitHeight((short) 1);
    printSetup.setFitWidth((short) 1);

    // Rows
    int rowNum = 0;

    for (Row row : sheet.getRows()) {
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.usermodel.HSSFPrintSetup

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.