Package org.apache.poi.ss.usermodel

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


     * @throws Exception if failed
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractNullityCondition_blank() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("invalid.xls");
        extractor.extractNullityCondition(sheet.getRow(4));
    }
View Full Code Here


     * @throws Exception if failed
     */
    @Test(expected = ExcelRuleExtractor.FormatException.class)
    public void extractNullityCondition_invalid_type() throws Exception {
        ExcelRuleExtractor extractor = new LegacyExcelRuleExtractor();
        Sheet sheet = sheet("invalid.xls");
        extractor.extractNullityCondition(sheet.getRow(5));
    }
View Full Code Here

            throw new IOException(MessageFormat.format(
                    "Failed to create an output directory for {0}",
                    output));
        }
        final Workbook workbook = Util.createEmptyWorkbookFor(output.getPath());
        Sheet sheet = workbook.createSheet("results");
        return new ExcelSheetSink(definition, sheet, version.getMaxColumns()) {
            private boolean closed = false;
            @Override
            public void close() throws IOException {
                if (closed) {
View Full Code Here

        if (matcher.group(1) != null) {
            int sheetNumber = Integer.parseInt(matcher.group(1));
            LOG.debug("Opening sheet by index : {}", sheetNumber);
            try {
                Sheet sheet = book.getSheetAt(sheetNumber);
                assert sheet != null;
                return sheet;
            } catch (RuntimeException e) {
                throw new IOException(MessageFormat.format(
                        "Excelシートの展開に失敗しました: {0} (シート{1}番がありません)",
                        source,
                        sheetNumber), e);
            }
        } else {
            String sheetName = matcher.group(2);
            LOG.debug("Opening sheet by name : {}", sheetName);
            assert sheetName != null;
            Sheet sheet = book.getSheet(sheetName);
            if (sheet == null) {
                throw new IOException(MessageFormat.format(
                        "Excelシートの展開に失敗しました: {0} (シート\"{1}\"がありません)",
                        source,
                        sheetName));
View Full Code Here

    }

    @Override
    public <T> VerifyRule get(
            DataModelDefinition<T> definition, VerifyContext context, URI source) throws IOException {
        Sheet sheet = Util.extract(source);
        if (sheet == null) {
            return null;
        }
        LOG.debug("Finding Excel sheet extractor: {}", source);
        ExcelRuleExtractor extractor = findExtractor(sheet);
View Full Code Here

    @Override
    public <T> DataModelSource open(
            DataModelDefinition<T> definition,
            URI source,
            TestContext context) throws IOException {
        Sheet sheet = Util.extract(source);
        if (sheet == null) {
            return null;
        }
        LOG.info("Excelシートをデータソースに利用します: {}", source);
        return new ExcelSheetDataModelSource(definition, source, sheet);
View Full Code Here

     * @throws Exception if occur
     */
    @Test
    public void supports() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("simple.xls");
        assertThat(extractor.supports(sheet), is(true));
    }
View Full Code Here

     * @throws Exception if occur
     */
    @Test
    public void xssf() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("simple.xlsx");
        assertThat(extractor.supports(sheet), is(true));
    }
View Full Code Here

     * @throws Exception if occur
     */
    @Test
    public void supports_not() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("invalid_format.xls");
        assertThat(extractor.supports(sheet), is(false));
    }
View Full Code Here

     * @throws Exception if occur
     */
    @Test
    public void supports_invalid_version() throws Exception {
        ExcelRuleExtractor extractor = new DefaultExcelRuleExtractor();
        Sheet sheet = sheet("invalid_format_version.xls");
        assertThat(extractor.supports(sheet), is(false));
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.usermodel.Sheet

Copyright © 2018 www.massapicom. 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.