Examples of Sheet


Examples of org.apache.poi.ss.usermodel.Sheet

    /**
     * Newlines are valid characters in a formula
     */
    public void test50440() throws Exception {
       Workbook wb = XSSFTestDataSamples.openSampleWorkbook("NewlineInFormulas.xlsx");
       Sheet s = wb.getSheetAt(0);
       Cell c = s.getRow(0).getCell(0);
      
       assertEquals("SUM(\n1,2\n)", c.getCellFormula());
       assertEquals(3.0, c.getNumericCellValue());
      
       FormulaEvaluator formulaEvaluator = wb.getCreationHelper().createFormulaEvaluator();
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

    public void test50299() throws Exception {
       Workbook wb = XSSFTestDataSamples.openSampleWorkbook("50299.xlsx");
      
       // Check all the colours
       for(int sn=0; sn<wb.getNumberOfSheets(); sn++) {
          Sheet s = wb.getSheetAt(sn);
          for(Row r : s) {
             for(Cell c : r) {
                CellStyle cs = c.getCellStyle();
                if(cs != null) {
                   cs.getFillForegroundColor();
                }
             }
          }
       }
      
       // Check one bit in detail
       // Check that we get back foreground=0 for the theme colours,
       //  and background=64 for the auto colouring
       Sheet s = wb.getSheetAt(0);
       assertEquals(0,  s.getRow(0).getCell(8).getCellStyle().getFillForegroundColor());
       assertEquals(64, s.getRow(0).getCell(8).getCellStyle().getFillBackgroundColor());
       assertEquals(0,  s.getRow(1).getCell(8).getCellStyle().getFillForegroundColor());
       assertEquals(64, s.getRow(1).getCell(8).getCellStyle().getFillBackgroundColor());
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

       int rowSplit = 2;
       int leftmostColumn = 3;
       int topRow = 4;

       for(Workbook wb : wbs) {
          Sheet s = wb.createSheet();
         
          // Populate
          for(int rn=0; rn<= topRow; rn++) {
             Row r = s.createRow(rn);
             for(int cn=0; cn<leftmostColumn; cn++) {
                Cell c = r.createCell(cn, Cell.CELL_TYPE_NUMERIC);
                c.setCellValue(100*rn + cn);
             }
          }
         
          // Create the Freeze Pane
          s.createFreezePane(colSplit, rowSplit, leftmostColumn, topRow);
          PaneInformation paneInfo = s.getPaneInformation();
         
          // Check it
          assertEquals(colSplit,       paneInfo.getVerticalSplitPosition());
          assertEquals(rowSplit,       paneInfo.getHorizontalSplitPosition());
          assertEquals(leftmostColumn, paneInfo.getVerticalSplitLeftColumn());
          assertEquals(topRow,         paneInfo.getHorizontalSplitTopRow());
         
         
          // Now a row only freezepane
          s.createFreezePane(0, 3);
          paneInfo = s.getPaneInformation();
         
          assertEquals(0,  paneInfo.getVerticalSplitPosition());
          assertEquals(3,  paneInfo.getHorizontalSplitPosition());
          if(wb == wbs[0]) {
             assertEquals(64, paneInfo.getVerticalSplitLeftColumn()); // HSSF
          } else {
             assertEquals(0,  paneInfo.getVerticalSplitLeftColumn()); // XSSF
          }
          assertEquals(3,  paneInfo.getHorizontalSplitTopRow());
         
          // Now a column only freezepane
          s.createFreezePane(4, 0);
          paneInfo = s.getPaneInformation();
         
          assertEquals(4,  paneInfo.getVerticalSplitPosition());
          assertEquals(0,  paneInfo.getHorizontalSplitPosition());
          assertEquals(4 , paneInfo.getVerticalSplitLeftColumn());
          assertEquals(0,  paneInfo.getHorizontalSplitTopRow());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

        }
    }

    private void processWorkbook(URI documentURI, Workbook wb, ExtractionResult er) {
        for (int sheetIndex = 0; sheetIndex < wb.getNumberOfSheets(); sheetIndex++) {
            final Sheet sheet = wb.getSheetAt(sheetIndex);
            final URI sheetURI = getSheetURI(documentURI, sheet);
            er.writeTriple(documentURI, excel.containsSheet, sheetURI);
            er.writeTriple(sheetURI, RDF.TYPE, excel.sheet);
            writeSheetMetadata(sheetURI, sheet, er);
            for (Row row : sheet) {
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

     * @throws Exception if occur
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractDataModelCondition_unknown() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("total_unknown.xls");
        extractor.extractDataModelCondition(sheet);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

     * @throws Exception if occur
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractDataModelCondition_blank() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("total_blank.xls");
        extractor.extractDataModelCondition(sheet);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

     * @throws Exception if occur
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractDataModelCondition_invalid() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("total_invalid.xls");
        extractor.extractDataModelCondition(sheet);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

     * @throws Exception if occur
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractDataModelCondition_missing() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("total_missing.xls");
        extractor.extractDataModelCondition(sheet);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

     * @throws Exception if occur
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractName_invalid() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("name.xls");
        extractor.extractName(sheet.getRow(8));
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet

     * @throws Exception if occur
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractValueCondition_unknown() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("value.xls");
        extractor.extractValueCondition(sheet.getRow(9));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.