type ="已还船舶--费用未结清";
}else{
type ="已还船舶--费用已结清";
}
property =getStr(pactdata,cell)+getStr(voyagename,cell)+getStr(voyageno,cell)+getStr(dwt,cell)+getStr(hirefrom,cell)
+getStr(deliveryposion,cell)+getStr(redeliveryposion,cell)+getStr(sheepowner,cell)+getStr(addr,cell)+getStr(addcomm,cell)
+getStr(rent,cell);
property = property.substring(1);
String split[] = property.split(",");
// System.out.println("-----------------------------property:"+property);
if(currentPage!=null!currentPage.trim().equals("")){
ncurrentPage =Integer.parseInt(currentPage);
}else{
OutJavaScript.outString(response, "Sorry! Failed to get information of pager.");
return null;
}
try {
session =getServiceLocator().getBaseHibernateDAO().getSession();
sql ="select count(*) "+from;
query =session.createQuery(sql);
list = query.list();
for (int i = 0; ilist.size(); i++) {
totalSize =(Integer)list.get(i);
if(totalSize!=0){
pager =new Pager(ncurrentPage,totalSize);
}
}
query =getServiceLocator().getBaseHibernateDAO().getSession().createQuery("select " +property+from);
if(condition!=nullcondition.trim().equals("1")){//分页数据
startRow = (ncurrentPage - 1)*pager.getPageSize();
query.setFirstResult(startRow);
query.setMaxResults(pager.getPageSize());
// System.out.println("---------------------------------------------------query:"+query);
}
list = query.list();
fileName = "shipInfo";
os = response.getOutputStream();
response.reset();
response.setHeader("Content-disposition",
"attachment; filename=" +fileName + ".xls");
response.setContentType("application/msexcel");
jxl.write.WritableWorkbook wbook = Workbook.createWorkbook(os);
jxl.write.WritableSheet wsheet = wbook.createSheet("the first sheet", 0);
for (int i = 0; isplit.length; i++) {
jxl.write.Label wlabel0;
wlabel0 = new jxl.write.Label(i, 0, getExcelTile(split[i]));
wsheet.addCell(wlabel0);
}
jxl.write.Label wlabel1;
for(int i=0;ilist.size();i++) {
if(split.length==1){
Object strval = (Object) list.get(i);
String javaScript=""+MyPublic.toHtmlStr(strval==null?"":strval.toString().trim())+"";
wlabel1 = new jxl.write.Label(0, i+1,strval==null?"":strval.toString().trim() );
wsheet.addCell(wlabel1);
}else{
Object[] strval = (Object[]) list.get(i);
for(int j=0;jstrval.length;j++) {
String javaScript=""+MyPublic.toHtmlStr(strval[j]==null?"":strval[j].toString().trim())+"";
//System.out.println("===================script:"+javaScript);
wlabel1 = new jxl.write.Label(j, i+1,strval[j]==null?"":strval[j].toString().trim() );
wsheet.addCell(wlabel1);
}
}
}
wbook.write();
response.flushBuffer();
wbook.close();
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Export Excel exception.");
e.printStackTrace();
} catch (HibernateException e1) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Database exception.");
e1.printStackTrace();
} catch (AppSystemException e1) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! System exception.");
e1.printStackTrace();
} catch (AppBusinessException e1) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Database exception.");
e1.printStackTrace();
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Export Excel exception.");
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Export Excel exception.");
推荐阅读
- jquery模糊查询去空格,javascript模糊查询
- 怎么让电脑显卡不更新显存,怎么设置不让显卡驱动自动更新
- vb.net删除窗体 vb删除代码怎么写
- java中redis的配置文件路径,redis配置文件位置
- 江苏综合网站搭建价格优惠,江苏省综合业务信息管理系统
- 怎么能测试显卡功耗,怎么看显卡功耗
- 包含c语言sqrt函数开源的词条
- 为什么手机cpu一年一换,手机cpu会老化吗
- 电脑路由器密码怎么看,怎么查看电脑路由器密码