我正在一个项目,该项目从excel文件导入信息,然后将其保存在另一个文件中。 我得到以下变量,我需要将它们作为单独的单元格存储在新行中
userID = "" + importUsers.getSheetAt(0).getRow(counter).getCell(5);
computername = "" + importUsers.getSheetAt(0).getRow(counter).getCell(21);
location = "" + importUsers.getSheetAt(0).getRow(counter).getCell(14);
migID = "" + importUsers.getSheetAt(0).getRow(counter).getCell(0);
然后我创建一个enterInfo.java实例
new enterInfo(userID, computername, location,migID,row);
哪些人上了这堂课
public class enterInfo extends JFrame{
public enterInfo(String userID, String computername, String location, String migID, int row) throws InvalidFormatException, IOException {
System.out.println("adding...");
File workbookFile = new File("C:\\Users\\strinca1\\Decomp\\activeUsers.xlsx.xlsx");
FileInputStream file = new FileInputStream(workbookFile);
Workbook activeUsers = WorkbookFactory.create(file);
Row reihe = activeUsers.getSheetAt(0).createRow((short)row);
// Create a cell and put a value in it.
Cell cell = reihe.createCell(0);
cell.setCellValue(1);
}
}
但是它没有向activeUsers.xlsx.xlsx
添加任何内容
我找不到我要去哪里哪里
非常感谢您提前提供帮助