
throws Exception
{
List<CarReport>list = null
if(deptid.equals("wlx")){
list = findCarWarning() //如果已经有list对像就不用查询了
} else {
list = findCarWarning(inwarning, datePoint, deptid)
}
String sheet = "车辆预警报表"
WritableWorkbook wbook = Workbook.createWorkbook(os)
WritableSheet wsheet = wbook.createSheet(sheet, 0)
wsheet.setPageSetup(PageOrientation.LANDSCAPE)
WritableCellFormat wcf = JxlUtil.getWritableHeaderCellFormat()
wsheet.mergeCells(0, 0, 6, 1)
wsheet.addCell(new Label(0, 0, "车辆预警报表", wcf))
wcf = JxlUtil.getWritableTitleCellFormat()
wsheet.setRowView(2,500)
wsheet.addCell(new Label(0, 2, "序号", wcf))
wsheet.addCell(new Label(1, 2, "预警项目", wcf))
wsheet.addCell(new Label(2, 2, "车牌号码", wcf))
wsheet.addCell(new Label(3, 2, "司机编码", wcf))
wsheet.addCell(new Label(4, 2, "司机名称", wcf))
wsheet.addCell(new Label(5, 2, "到期日期", wcf))
wsheet.addCell(new Label(6, 2, "剩余天数", wcf))
wsheet.setColumnView(0, 10)
wsheet.setColumnView(1, 20)
wsheet.setColumnView(2, 20)
wsheet.setColumnView(3, 20)
wsheet.setColumnView(4, 20)
wsheet.setColumnView(5, 20)
wsheet.setColumnView(6, 15)
wcf = JxlUtil.getWritableContentCellFormat()
int m = 3
for (CarReport carReport : list) {
wsheet.setRowView(m, 340)
wsheet.addCell(new Label(0, m, carReport.getNum()+"", wcf))
wsheet.addCell(new Label(1, m, carReport.getCheckitem(), wcf))
wsheet.addCell(new Label(2, m, carReport.getCarbrand(), wcf))
wsheet.addCell(new Label(3, m, carReport.getSn(), wcf))
wsheet.addCell(new Label(4, m, carReport.getUsername(), wcf))
if(carReport.getWarnitem() != null &&!"".equals(carReport.getWarnitem()))
wsheet.addCell(new Label(5, m, sf.format(carReport.getWarnitem()), wcf))
else
wsheet.addCell(new Label(5, m, "", wcf))
wsheet.addCell(new Label(6, m, carReport.getRemaindate()+"", wcf))
m++
}
wbook.write()
wbook.close()
os.close()
}
}
所需求的jar包有,jxl.jar 好像还有一个,到时你在网上搜索一下下载就好了
你是想通过d出窗口中点击添加数据,然后显示在父窗口么。这样要通过js(javascript)来实现:
在js中opener这个对象为前一个窗口,可以使用window.opener.document...调用document的相关方法来获取前一窗口所有元素。
也就是说页面A open 页面 B 那么,在页面B中可以通过window.opener.document...调用页面A的元素。
这样说,你能明白么?
如果你说关闭子窗口,才刷新父窗体,那是模式窗口,也就是用window.showModalDialog()来打开页面,至于获取方式比较复杂,不是一两句话就能概括的,呵呵 多翻点资料吧~~
先写dao 再写service 再开发servlet和jsp界面jsp form 表达发请求给servlet servlet调用对应的Service接口中的方法
Service接口调用dao接口方法即可,在dao的实现类中调用数据库 增删改查
联系我邮箱373828882我发你一些现有的项目
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)