<% @ Page contentType = "text/html; charset = gb2312" language = "java" import = "java. SQL. *" %>
<% @ Page import = "jxl. *" %>
<% @ Page import = "jxl. write. *" %>
<% @ Page import = "java. io. *" %>
<% @ Page import = "java. util. *" %>
<Jsp (preferred for SUN Enterprise Applications): useBean id = "conn" class = "db. DbConnection" scope = "page"/>
<%
String SQL = (String) session. getValue ("SQL ");
// String apti = (String) session. getValue ("apti ");
// Select companyapti. companyid, companyapti. companytype, companyapti. c
Ompanyname, companyinfo. province, companyinfo. city, companyinfo. address,
// Companyinfo. connectman, companyinfo. mobile, companyinfo. tel, companyinfo. telephone
%>
<%
Try {
WritableWorkbook workbook = Workbook. createWorkbook (new File (request. getRealPath ("/") + "/mis/" + "/enterprise info. xls "));
// Create an Excel worksheet
WritableSheet sheet = workbook. createSheet ("enterprise information", 0 );
// Jxl. write. WritableSheet ws = wwb. createSheet ("Test Sheet 1", 0 );
// Set the font and format
// Writer data
// While (rs. next () {// while start
// For (int I = 1; I <= 23; I ++ ){
// Username = rs. getString (1). equals ("0 ")? "": Rs. getString (1). trim ();
// Username = "yzhxy2002 ";
// Label l = new Label (0, 0, username );
// Sheet. addCell (l );
// Jxl. write. Label labelC = new jxl. write. Label (1, 0, "This is a Label cell ");
// Sheet. addCell (labelC );
Label n = null, p = null, c = null, a = null, m = null, s = null, t = null, t1 = null, t2 = null;
String companyid = "", apti = "", aptiname = "", companyname = "", companytype = "", province = "",
City = "", address = "", connectman = "", mobile = "", tel = "", telephone = "";
ResultSet rs = null;
// Out. print (SQL );
Rsw.conn.exe cuteQuery (SQL );
Int I = 0;
While (rs. next ()){
// Query qualifications
StringTokenizer fenxi = new StringTokenizer (rs. getString ("companytype "),"-");
While (fenxi. hasMoreTokens ()){
Companytype = fenxi. nextToken (). toString ();
String sql0 = "select * from aptitype where typeid =" + companytype + "";
ResultSet rs01_conn.exe cuteQuery (sql0 );
If (rs0.next ()){
Aptiname = new String (rs0.getString ("typename"). getBytes ("iso8859-1 "));
}
Apti = aptiname + "-" + apti;
} // While
//
N = new Label (0, I, new String (rs. getString ("companyname"). getBytes ("iso8859-1 ")));
P = new Label (1, I, new String (rs. getString ("province"). getBytes ("iso8859-1 ")));
C = new Label (2, I, new String (rs. getString ("city"). getBytes ("iso8859-1 ")));
A = new Label (3, I, new String (rs. getString ("address"). getBytes ("iso8859-1 ")));
M = new Label (4, I, new String (rs. getString ("connectman"). getBytes ("iso8859-1 ")));
S = new Label (5, I, rs. getString ("mobile "));
T = new Label (6, I, rs. getString ("tel "));
T1 = new Label (7, I, rs. getString ("telephone "));
T2 = new Label (8, I, apti );