Example usage for org.apache.poi.ss.usermodel PrintSetup getUsePage

List of usage examples for org.apache.poi.ss.usermodel PrintSetup getUsePage

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel PrintSetup getUsePage.

Prototype

boolean getUsePage();

Source Link

Document

Returns the use page numbers.

Usage

From source file:org.bbreak.excella.reports.ReportsTestUtil.java

License:Open Source License

/**
 * ?????/*w ww.  j av a  2s  .c o m*/
 * 
 * @param printSetup ?
 * @return ???
 */
public static String getPrintSetupString(PrintSetup printSetup) {
    StringBuffer sb = new StringBuffer();
    if (printSetup != null) {
        sb.append("PaperSize=").append(printSetup.getPaperSize()).append(",");
        sb.append("Scale=").append(printSetup.getScale()).append(",");
        sb.append("PageStart=").append(printSetup.getPageStart()).append(",");
        sb.append("FitWidth=").append(printSetup.getFitWidth()).append(",");
        sb.append("FitHeight=").append(printSetup.getFitHeight()).append(",");
        sb.append("LeftToRight=").append(printSetup.getLeftToRight()).append(",");
        sb.append("Landscape=").append(printSetup.getLandscape()).append(",");
        sb.append("ValidSettings=").append(printSetup.getValidSettings()).append(",");
        sb.append("NoColor=").append(printSetup.getNoColor()).append(",");
        sb.append("Draft=").append(printSetup.getDraft()).append(",");
        sb.append("Notes=").append(printSetup.getNotes()).append(",");
        sb.append("NoOrientation=").append(printSetup.getNoOrientation()).append(",");
        sb.append("UsePage=").append(printSetup.getUsePage()).append(",");
        sb.append("HResolution=").append(printSetup.getHResolution()).append(",");
        sb.append("VResolution=").append(printSetup.getVResolution()).append(",");
        sb.append("HeaderMargin=").append(printSetup.getHeaderMargin()).append(",");
        sb.append("FooterMargin=").append(printSetup.getFooterMargin()).append(",");
        sb.append("Copies=").append(printSetup.getCopies());
    }
    return sb.toString();

}

From source file:org.bbreak.excella.reports.util.ReportsUtil.java

License:Open Source License

/**
 * fromIdx??toIdx?????//from www. ja  v  a2  s.c  o  m
 * @param workbook fromIdx?toIdx??workbook
 * @param fromIdx ?
 * @param sheet 
 */
public static void copyPrintSetup(Workbook workbook, int fromIdx, Sheet toSheet) {
    Sheet fromSheet = workbook.getSheetAt(fromIdx);
    // ?
    PrintSetup fromPrintSetup = fromSheet.getPrintSetup();
    PrintSetup printSetup = toSheet.getPrintSetup();
    printSetup.setCopies(fromPrintSetup.getCopies());
    printSetup.setDraft(fromPrintSetup.getDraft());
    printSetup.setFitHeight(fromPrintSetup.getFitHeight());
    printSetup.setFitWidth(fromPrintSetup.getFitWidth());
    printSetup.setFooterMargin(fromPrintSetup.getFooterMargin());
    printSetup.setHeaderMargin(fromPrintSetup.getHeaderMargin());
    printSetup.setHResolution(fromPrintSetup.getHResolution());
    printSetup.setLandscape(fromPrintSetup.getLandscape());
    printSetup.setLeftToRight(fromPrintSetup.getLeftToRight());
    printSetup.setNoColor(fromPrintSetup.getNoColor());
    printSetup.setNoOrientation(fromPrintSetup.getNoOrientation());
    printSetup.setPageStart(fromPrintSetup.getPageStart());
    printSetup.setPaperSize(fromPrintSetup.getPaperSize());
    printSetup.setScale(fromPrintSetup.getScale());
    printSetup.setUsePage(fromPrintSetup.getUsePage());
    printSetup.setValidSettings(fromPrintSetup.getValidSettings());
    printSetup.setVResolution(fromPrintSetup.getVResolution());
    // ?
    String printArea = workbook.getPrintArea(fromIdx);
    if (printArea != null) {
        if (printArea.contains("!")) {
            printArea = printArea.substring(printArea.indexOf("!") + 1);
        }
        int toIdx = workbook.getSheetIndex(toSheet);
        workbook.setPrintArea(toIdx, printArea);
    }
    // ?
    toSheet.setRepeatingColumns(fromSheet.getRepeatingColumns());
    toSheet.setRepeatingRows(fromSheet.getRepeatingRows());
}