//續2
for(Integer in : exception.keySet())
{
ArrayList<Date> ds = exception.get(in);
if(in == 100)
{
for(Date d : ds)
{
ws[2].addCell(new Label(0,i,String.format("%tF", d),cf));
ws[2].addCell(new Label(1,i++,"absent",cf));
}
}
else if(ds.size()==1)
{
ws[2].addCell(new Label(0,i,String.format(dateFormat, ds.get(0)),cf));
ws[2].addCell(new Label(1,i,"once only",cf));
if(ds.get(0).getHours()<12)
{
time.setParas(ds.get(0),Const.pm.getTime());
}
else
{
time.setParas(Const.am.getTime(),ds.get(0));
}
ws[2].addCell(new Label(2,i++,time.toString(),cf));
}
else
{
ws[2].addCell(new Label(0,i,String.format(dateFormat, ds.get(0)),cf));
ws[2].addCell(new Label(1,i,String.format(dateFormat, ds.get(1)),cf));
time.setParas(ds.get(0), ds.get(1));
ws[2].addCell(new Label(2,i++,time.toString(),cf));
}
}
cf = new WritableCellFormat(new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD));
cf.setBorder(Border.ALL, BorderLineStyle.DASH_DOT_DOT, Colour.BLUE);
ws[0].addCell(new Label(2,ws[0].getRows(),time.getExtra_weekend_all(),cf));
ws[1].addCell(new Label(2,ws[1].getRows(),time.getExtra_weekday_all(),cf));
ws[2].addCell(new Label(2,ws[2].getRows(),time.getLate_time_all(),cf));
ws[2].addCell(new Label(2,ws[2].getRows(),time.getEarly_time_all(),cf));
ws[2].addCell(new Label(2,ws[2].getRows(),time.getLateAndEarlyTimeAll(),cf));
wbook.write();
wbook.close();
book.close();
}
catch (IndexOutOfBoundsException e)
{
log.error("參數格式錯誤,請重試!");
return false;
}
catch (FileNotFoundException e)
{
log.error("輸入的文件不存在,或目標文件格式錯誤,請重試!");
return false;
}
catch (Exception e)
{
e.printStackTrace();
log.error(e);
return false;
}
log.info(srcFile+" 's finished.");
return true;
}
}