私は、次のコードを試みたが、提案のproperly.Anyタイプが動作していないが以前のデータを消去せずにExcelシートにデータを書き込む方法は?
public static void main(String[] args) throws EncryptedDocumentException, InvalidFormatException, IOException {
InputStream inp = new FileInputStream("C:\\Documents and Settings\\Administrator\\Desktop\\Read Data.xlsx");
Workbook wb = WorkbookFactory.create(inp);
Sheet sheet = wb.getSheetAt(0);
Row row = sheet.getRow(1);
Cell cell = row.getCell(0);
cell.setCellType(cell.CELL_TYPE_STRING);
String cellContents = cell.getStringCellValue();
//Modify the cellContents here
// Write the output to a file
//cell.setCellValue(cellContents);
FileOutputStream fileOut = new FileOutputStream("C:\\Documents and Settings\\Administrator\\Desktop\\Read Data.xlsx");
sheet.createRow(1).createCell(1).setCellValue(cellContents);
wb.write(fileOut);
fileOut.close();
System.out.println(cellContents);
}
いいえ、その動作していません。以前のデータが消去されました.. –