|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
你总不能说你写框架吧,那无疑会加大工作量,现在大多企业采取的是折中的办法,就是改别人写好的框架,可要改框架,前提是你对这个框架足够的了解,这就更难了。js<%@pagecontentType="text/html;charset=gb2312"language="java"import="java.sql.*"%>
<%@pageimport="jxl.*"%>
<%@pageimport="jxl.write.*"%>
<%@pageimport="java.io.*"%>
<%@pageimport="java.util.*"%>
<jsp:useBeanid="conn"class="db.DbConnection"scope="page"/>
<%
Stringsql=(String)session.getValue("sql");
//Stringapti=(String)session.getValue("apti");
//selectcompanyapti.companyid,companyapti.companytype,companyapti.c
ompanyname,companyinfo.province,companyinfo.city,companyinfo.address,
//companyinfo.connectman,companyinfo.mobile,companyinfo.tel,companyinfo.telephone
%>
<%
try{
WritableWorkbookworkbook=Workbook.createWorkbook(newFile(request.getRealPath("/")+"/mis/"+"/企业信息.xls"));
//创立Excel事情表
WritableSheetsheet=workbook.createSheet("企业信息",0);
//jxl.write.WritableSheetws=wwb.createSheet("TestSheet1",0);
//设置字体和格局
//writerdata
//while(rs.next()){//whilestart
//for(inti=1;i<=23;i++){
//username=rs.getString(1).equals("0")?"":rs.getString(1).trim();
//username="yzhxy2002";
//Labell=newLabel(0,0,username);
//sheet.addCell(l);
//jxl.write.LabellabelC=newjxl.write.Label(1,0,"ThisisaLabelcell");
//sheet.addCell(labelC);
Labeln=null,p=null,c=null,a=null,m=null,s=null,t=null,t1=null,t2=null;
Stringcompanyid="",apti="",aptiname="",companyname="",companytype="",province="",
city="",address="",connectman="",mobile="",tel="",telephone="";
ResultSetrs=null;
//out.print(sql);
rs=conn.executeQuery(sql);
inti=0;
while(rs.next()){
//查询天分
StringTokenizerfenxi=newStringTokenizer(rs.getString("companytype"),"-");
while(fenxi.hasMoreTokens()){
companytype=fenxi.nextToken().toString();
Stringsql0="select*fromaptitypewheretypeid="+companytype+"";
ResultSetrs0=conn.executeQuery(sql0);
if(rs0.next()){
aptiname=newString(rs0.getString("typename").getBytes("iso8859-1"));
}
apti=aptiname+"-"+apti;
}//while
//
n=newLabel(0,i,newString(rs.getString("companyname").getBytes("iso8859-1")));
p=newLabel(1,i,newString(rs.getString("province").getBytes("iso8859-1")));
c=newLabel(2,i,newString(rs.getString("city").getBytes("iso8859-1")));
a=newLabel(3,i,newString(rs.getString("address").getBytes("iso8859-1")));
m=newLabel(4,i,newString(rs.getString("connectman").getBytes("iso8859-1")));
s=newLabel(5,i,rs.getString("mobile"));
t=newLabel(6,i,rs.getString("tel"));
t1=newLabel(7,i,rs.getString("telephone"));
t2=newLabel(8,i,apti);
sheet.addCell(n);sheet.addCell(p);sheet.addCell(c);
sheet.addCell(a);sheet.addCell(m);sheet.addCell(s);sheet.addCell(t);sheet.addCell(t1);
sheet.addCell(t2);
i++;
apti="";
}
//out.print(rs.get(0,2));
//第二个表
//WritableSheetsheet1=workbook.createSheet("天分信息",1);
//companytype
workbook.write();
workbook.close();
//}
//}//whileend
}
catch(Exceptione)
{
e.printStackTrace();
}
%>
<html>
<head>
<title>操纵Excel表</title>
</head>
<body>
<tablewidth="653"border="0"align="center"cellpadding="0"cellspacing="0">
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<tdheight="46"><divalign="center"><ahref="企业信息.xls">
<imgsrc=http://www.163design.net/j/f/".images/ziguang.gif"width="32"height="32"border="0">下载企业信息</a></div></td>
</tr>
<tr>
<td><br>
</td>
</tr>
<tr>
<td></td>
</tr>
</table>
</body>
</html>
不得不提一下的是:.net是看到java红,而开发出来的工具。 |
|