可以将多少行数据解析到eclipse控制台中是否有限制?

时间:2018-01-19 10:20:20

标签: java eclipse parsing

例如,我正在将Excel中的数据解析为Eclipse中的java项目。我最终将它传递给一些描述的数据库,但是我现在正在使用system.out.println语句来查看正在解析的文件数量。这就是我的困惑所在,excel表中有36,616行,但我使用的解析代码只从位置33,269解析为36,616,而不是1到33,616。我很困惑这是解析代码的一个问题,还是控制台要处理的行太多了?

我的解析器

public class ExcelReader {

    public static final String SAMPLE_XLSX_FILE_PATH = "./LatLongPrice.xlsx";

    public static void main(String[] args) throws IOException, InvalidFormatException {

        Workbook workbook = WorkbookFactory.create(new File(SAMPLE_XLSX_FILE_PATH));

        // Retrieving the number of sheets in the Workbook
        System.out.println("Workbook has " + workbook.getNumberOfSheets() + " Sheets : ");




        // obtain a sheetIterator and iterate over it
        Iterator<Sheet> sheetIterator = workbook.sheetIterator();
        System.out.println("Retrieving Sheets using Iterator");
        while (sheetIterator.hasNext()) {
            Sheet sheet = sheetIterator.next();
            System.out.println("=> " + sheet.getSheetName());
        }



        // Getting the Sheet at index zero
        Sheet sheet = workbook.getSheetAt(0);

        // Create a DataFormatter to format and get each cell's value as String
        DataFormatter dataFormatter = new DataFormatter();

        // Obtain a rowIterator and columnIterator and iterate over them
        System.out.println("\n\nIterating over Rows and Columns using Iterator\n");
        Iterator<Row> rowIterator = sheet.rowIterator();
        while (rowIterator.hasNext()) {
            Row row = rowIterator.next();

            // Iteratating over the columns of the current row
           Iterator<Cell> cellIterator = row.cellIterator();

            while (cellIterator.hasNext()) {
                Cell cell = cellIterator.next();
                String cellValue = dataFormatter.formatCellValue(cell);
                System.out.print(cellValue + "\t");
            }
            System.out.println();
        }
        });

        // Closing the workbook
        workbook.close();
    }

0 个答案:

没有答案