java读excel文件

public static void test() {
		int count = 16;
		File tmp = new File("F:\\听辩第一次\\铃音" + String.valueOf(count)
				+ "midi-1.xls");
		try {
			Workbook workbook = Workbook.getWorkbook(tmp);
			for (String sheetname : new String[] { "Sheet2" }) {
				Sheet sheet = workbook.getSheet(sheetname);
				int rows = sheet.getRows();
				for (int i = 1; i < rows; i++) {
					StringBuilder sb = new StringBuilder();
					if (sheet.getRow(i).length < 5) {
						System.out.println(sheet.getRow(i)[0].getContents());
						continue;
					}
					if (!(sheet.getRow(i)[2].getContents().equals("OK"))) {
						System.out.println(sheet.getRow(i)[0].getContents());
					}

				}
				
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

你可能感兴趣的:(java,Excel,F#)