-2
的Java類如何在excel文件中編寫?
public void CandidateUpload(String path) {
try {
FileInputStream file = new FileInputStream(new File(path));
XSSFWorkbook workbook = new XSSFWorkbook(file);
XSSFSheet sheet = workbook.getSheetAt(0);
int c = 1;
while (c < sheet.getPhysicalNumberOfRows()) {
Row row1 = sheet.getRow(c);
String firstname = row1.getCell(5).toString().trim();
String lastname = row1.getCell(6).toString().trim();
System.out.println("%%**---**" + firstname);
System.out.println("%%**----**" + lastname);
Cell name = row1.createCell(12);
name.setCellValue("gokul");
// sheet.getRow(12).getCell(11).setCellValue("gokul");
c++;
}
} catch (Exception e) {
System.out.println("Exception" + e);
e.printStackTrace();
} finally {
}}
error:28-Dec-2015 20:34:01.914 WARNING [http-nio-8084-exec-67] .opensymphony.xwork2.util.logging.commons.CommonsLogger.warn Content-Type not allowed: file "300634.xlsx" "upload_76a722f4_151e90da166__7fff_00000002.tmp" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
警告*********** NetBeans的HTTP監視器************ 請求不能被記錄很可能是因爲NetBeans的HTTP監視器模塊被禁用。
java.lang.NoSuchFieldException:resourceEntries –
能否請您解釋一下什麼問題,你用更多的細節面對? –
如何在excel表格中插入值? –