List of usage examples for org.apache.poi.xssf.usermodel XSSFWorkbook getNumberOfSheets
@Override public int getNumberOfSheets()
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BasicReportTest.java
License:Open Source License
@Test public void testRunReportWithJpegXlsxFormulasReport() throws BirtException, IOException { InputStream inputStream = runAndRenderReport("SimpleWithJpegDisplayFormulas.rptdesign", "xlsx"); assertNotNull(inputStream);//from ww w .j ava 2 s .c om try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Simple Test Report", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(true, sheet.isDisplayFormulas()); assertEquals(true, sheet.isDisplayGridlines()); assertEquals(true, sheet.isDisplayRowColHeadings()); assertEquals(true, sheet.isDisplayZeros()); performSimpleWithJpegTests(sheet); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BasicReportTest.java
License:Open Source License
@Test public void testRunReportWithJpegXlsxGridlinesRenderOption() throws BirtException, IOException { displayGridlines = false;//from w w w. j ava2 s . com InputStream inputStream = runAndRenderReport("SimpleWithJpeg.rptdesign", "xlsx"); assertNotNull(inputStream); try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Simple Test Report", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(false, sheet.isDisplayFormulas()); assertEquals(false, sheet.isDisplayGridlines()); assertEquals(true, sheet.isDisplayRowColHeadings()); assertEquals(true, sheet.isDisplayZeros()); performSimpleWithJpegTests(sheet); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BasicReportTest.java
License:Open Source License
@Test public void testRunReportWithJpegXlsxGridlinesReport() throws BirtException, IOException { InputStream inputStream = runAndRenderReport("SimpleWithJpegHideGridlines.rptdesign", "xlsx"); assertNotNull(inputStream);//from w w w .ja v a 2s .c o m try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Simple Test Report", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(false, sheet.isDisplayFormulas()); assertEquals(false, sheet.isDisplayGridlines()); assertEquals(true, sheet.isDisplayRowColHeadings()); assertEquals(true, sheet.isDisplayZeros()); performSimpleWithJpegTests(sheet); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BasicReportTest.java
License:Open Source License
@Test public void testRunReportWithJpegXlsxRowColHeadingsRenderOption() throws BirtException, IOException { displayRowColHeadings = false;/*www .j a v a 2s. com*/ InputStream inputStream = runAndRenderReport("SimpleWithJpeg.rptdesign", "xlsx"); assertNotNull(inputStream); try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Simple Test Report", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(false, sheet.isDisplayFormulas()); assertEquals(true, sheet.isDisplayGridlines()); assertEquals(false, sheet.isDisplayRowColHeadings()); assertEquals(true, sheet.isDisplayZeros()); performSimpleWithJpegTests(sheet); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BasicReportTest.java
License:Open Source License
@Test public void testRunReportWithJpegXlsxRowColHeadingsReport() throws BirtException, IOException { InputStream inputStream = runAndRenderReport("SimpleWithJpegHideRowColHeadings.rptdesign", "xlsx"); assertNotNull(inputStream);//from www .j a va 2 s .c o m try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Simple Test Report", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(false, sheet.isDisplayFormulas()); assertEquals(true, sheet.isDisplayGridlines()); assertEquals(false, sheet.isDisplayRowColHeadings()); assertEquals(true, sheet.isDisplayZeros()); performSimpleWithJpegTests(sheet); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BasicReportTest.java
License:Open Source License
@Test public void testRunReportWithJpegXlsxZerosRenderOption() throws BirtException, IOException { displayZeros = false;//from w w w. j ava 2s .com InputStream inputStream = runAndRenderReport("SimpleWithJpeg.rptdesign", "xlsx"); assertNotNull(inputStream); try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Simple Test Report", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(false, sheet.isDisplayFormulas()); assertEquals(true, sheet.isDisplayGridlines()); assertEquals(true, sheet.isDisplayRowColHeadings()); assertEquals(false, sheet.isDisplayZeros()); performSimpleWithJpegTests(sheet); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BasicReportTest.java
License:Open Source License
@Test public void testRunReportWithJpegXlsxZerosReport() throws BirtException, IOException { InputStream inputStream = runAndRenderReport("SimpleWithJpegHideZeros.rptdesign", "xlsx"); assertNotNull(inputStream);//from ww w. j ava 2 s. c o m try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Simple Test Report", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(false, sheet.isDisplayFormulas()); assertEquals(true, sheet.isDisplayGridlines()); assertEquals(true, sheet.isDisplayRowColHeadings()); assertEquals(false, sheet.isDisplayZeros()); performSimpleWithJpegTests(sheet); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.BigCrosstabTest.java
License:Open Source License
@Test public void testXlsx() throws Exception { InputStream inputStream = runAndRenderReport("BigCrosstab.rptdesign", "xlsx"); assertNotNull(inputStream);//from w w w. j a v a 2 s .c o m try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals(13, workbook.getNumCellStyles()); assertEquals("Big Crosstab Report 1", workbook.getSheetAt(0).getSheetName()); assertEquals(60, workbook.getSheetAt(0).getRow(1).getCell(2).getCellStyle().getRotation()); assertEquals(60, workbook.getSheetAt(0).getRow(2).getCell(2).getCellStyle().getRotation()); assertEquals(60, workbook.getSheetAt(0).getRow(2).getCell(3).getCellStyle().getRotation()); assertEquals(0, workbook.getSheetAt(0).getRow(3).getCell(2).getCellStyle().getRotation()); assertTrue(runTime - startTime < 4500L); assertTrue(renderTime - runTime < 4000L); Sheet sheet = workbook.getSheetAt(0); assertEquals(236, firstNullRow(sheet)); assertEquals(28, greatestNumColumns(sheet)); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.Borders1ReportTest.java
License:Open Source License
@Test public void testRunReport() throws BirtException, IOException { InputStream inputStream = runAndRenderReport("Borders1.rptdesign", "xlsx"); assertNotNull(inputStream);//from w w w . ja v a 2 s . c o m try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Borders Test Report 1", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(12, firstNullRow(sheet)); int i = 0; assertBorder(sheet, i++, 0, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN, CellStyle.BORDER_THIN); assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM); assertBorder(sheet, i++, 0, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK, CellStyle.BORDER_THICK); assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED); assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED); assertBorder(sheet, i++, 0, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED, CellStyle.BORDER_DOTTED); assertBorder(sheet, i++, 0, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED, CellStyle.BORDER_DASHED); assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED); assertBorder(sheet, i++, 0, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED, CellStyle.BORDER_MEDIUM_DASHED); assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE); assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE); assertBorder(sheet, i++, 0, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE, CellStyle.BORDER_DOUBLE); } finally { inputStream.close(); } }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.Borders2ReportTest.java
License:Open Source License
@Test public void testRunReport() throws BirtException, IOException { removeEmptyRows = false;/* w ww . jav a 2s . c om*/ InputStream inputStream = runAndRenderReport("Borders2.rptdesign", "xlsx"); assertNotNull(inputStream); try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); assertNotNull(workbook); assertEquals(1, workbook.getNumberOfSheets()); assertEquals("Borders Test Report 2", workbook.getSheetAt(0).getSheetName()); Sheet sheet = workbook.getSheetAt(0); assertEquals(4, firstNullRow(sheet)); assertBorder(sheet, 1, 2, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM); assertBorder(sheet, 1, 4, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM, CellStyle.BORDER_MEDIUM); } finally { inputStream.close(); } }