Example usage for org.apache.poi.ss.usermodel Sheet TopMargin

List of usage examples for org.apache.poi.ss.usermodel Sheet TopMargin

Introduction

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

Prototype

short TopMargin

To view the source code for org.apache.poi.ss.usermodel Sheet TopMargin.

Click Source Link

Usage

From source file:uk.co.spudsoft.birt.emitters.excel.tests.PageLayoutTest.java

License:Open Source License

@Test
public void testRunReportPixelsXls() throws BirtException, IOException {

    InputStream inputStream = runAndRenderReport("PageLayoutPixels.rptdesign", "xls");
    assertNotNull(inputStream);//from   ww  w. j  a v  a 2  s .c om
    try {

        HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
        assertNotNull(workbook);

        assertEquals(1, workbook.getNumberOfSheets());
        assertEquals("Page Layout Test", workbook.getSheetAt(0).getSheetName());

        HSSFSheet sheet0 = workbook.getSheetAt(0);
        HSSFPrintSetup printSetup = sheet0.getPrintSetup();
        assertEquals(HSSFPrintSetup.A4_PAPERSIZE, printSetup.getPaperSize());
        assertEquals(true, printSetup.getLandscape());
        assertEquals(0.5, printSetup.getHeaderMargin(), 0.01);
        assertEquals(0.5, printSetup.getFooterMargin(), 0.01);
        assertEquals(0.75, sheet0.getMargin(Sheet.LeftMargin), 0.01);
        assertEquals(0.75, sheet0.getMargin(Sheet.RightMargin), 0.01);
        assertEquals(1.0, sheet0.getMargin(Sheet.TopMargin), 0.01);
        assertEquals(1.0, sheet0.getMargin(Sheet.BottomMargin), 0.01);

    } finally {
        inputStream.close();
    }
}