Search in sources :

Example 1 with HSSFPrintSetup

use of org.apache.poi.hssf.usermodel.HSSFPrintSetup in project adempiere by adempiere.

the class AbstractExcelExporter method formatPage.

protected void formatPage(HSSFSheet sheet) {
    sheet.setFitToPage(true);
    // Print Setup
    HSSFPrintSetup ps = sheet.getPrintSetup();
    ps.setFitWidth((short) 1);
    ps.setNoColor(true);
    ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
    ps.setLandscape(false);
}
Also used : HSSFPrintSetup(org.apache.poi.hssf.usermodel.HSSFPrintSetup)

Example 2 with HSSFPrintSetup

use of org.apache.poi.hssf.usermodel.HSSFPrintSetup in project poi by apache.

the class TestPageSettingsBlock method testPrintSetup_bug46548.

public void testPrintSetup_bug46548() {
    // 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");
    }
}
Also used : HSSFPrintSetup(org.apache.poi.hssf.usermodel.HSSFPrintSetup) HSSFSheet(org.apache.poi.hssf.usermodel.HSSFSheet) AssertionFailedError(junit.framework.AssertionFailedError) HSSFWorkbook(org.apache.poi.hssf.usermodel.HSSFWorkbook)

Aggregations

HSSFPrintSetup (org.apache.poi.hssf.usermodel.HSSFPrintSetup)2 AssertionFailedError (junit.framework.AssertionFailedError)1 HSSFSheet (org.apache.poi.hssf.usermodel.HSSFSheet)1 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)1