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

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

Introduction

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

Prototype

short LeftMargin

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

Click Source Link

Usage

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

License:Open Source License

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

    InputStream inputStream = runAndRenderReport("PageLayout.rptdesign", "xls");
    assertNotNull(inputStream);/*from  w ww  . j a va 2 s .c o  m*/
    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(1.0 / 2.54, printSetup.getHeaderMargin(), 0.01);
        assertEquals(1.0 / 2.54, printSetup.getFooterMargin(), 0.01);
        assertEquals(0.7 / 2.54, sheet0.getMargin(Sheet.LeftMargin), 0.01);
        assertEquals(0.7 / 2.54, sheet0.getMargin(Sheet.RightMargin), 0.01);
        assertEquals(1.7 / 2.54, sheet0.getMargin(Sheet.TopMargin), 0.01);
        assertEquals(1.7 / 2.54, sheet0.getMargin(Sheet.BottomMargin), 0.01);

    } finally {
        inputStream.close();
    }
}

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

License:Open Source License

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

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

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

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

        XSSFSheet sheet0 = workbook.getSheetAt(0);
        XSSFPrintSetup printSetup = sheet0.getPrintSetup();
        assertEquals(PaperSize.A4_PAPER, printSetup.getPaperSizeEnum());
        assertEquals(PrintOrientation.LANDSCAPE, printSetup.getOrientation());
        assertEquals(0.3, printSetup.getHeaderMargin(), 0.01);
        assertEquals(0.3, printSetup.getFooterMargin(), 0.01);
        assertEquals(0.7, sheet0.getMargin(Sheet.LeftMargin), 0.01);
        assertEquals(0.7, sheet0.getMargin(Sheet.RightMargin), 0.01);
        assertEquals(0.75, sheet0.getMargin(Sheet.TopMargin), 0.01);
        assertEquals(0.75, sheet0.getMargin(Sheet.BottomMargin), 0.01);

    } finally {
        inputStream.close();
    }
}

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);/*  w ww .  jav a2 s.co m*/
    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();
    }
}