我正在创建一个Excel工作表并将数据写入其中。我将在另一个程序中阅读excel表。
现在,用户可以更新excel表中的数据。但是,如果用户删除当前数据并且不在该单元格中添加任何值,则excel应自动添加默认值。我怎么能在java中做到这一点?
我发布了一个在单元格中写入一些值的函数:
....
public static final void addVerificationTagData(Document d){
String data[] = {"Y","Y","N","N","Y","Y","Y","Y","Y","Y","N","N","Y","Y","N","N","Y","Y","N","N","N","N"};
//HSSFSheet sheet = workbook.getSheet("EDR Raw Data");
int personLen = d.getElementsByTagName("ecs:Person").getLength();
for(int i = 1;i <= personLen;i++){
int count = 0;
for(int rn = 6;rn <= 27;rn++){
Row r = sheet.getRow(rn);
r.createCell(i).setCellValue(data[count]);
//r.setRowStyle(cellStyle1);
count++;
}
//sheet.autoSizeColumn(i);
}
}
....
如果用户从单元格中删除了该值并且没有添加任何内容,是否有任何方法可以将添加的值设置为默认值?