public class TestExc {
public static void main(String[] args){
HSSFWorkbook hssfwork =new HSSFWorkbook();
HSSFSheet sheet =hssfwork.createSheet("sheet1");
HSSFRow row=sheet.createRow(1);
HSSFCell cell =row.createCell((short)0);
cell.setCellValue("123");
HSSFCell cel =row.createCell((short)1);
cel.setCellValue("123");
HSSFCell ce =row.createCell((short)2);
ce.setCellValue("123");
HSSFCell c =row.createCell((short)3);
c.setCellValue("123");
try {
hssfwork.write(new FileOutputStream("c:\\love.xls"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}}
=============================================================
下面是批量修改时能用到的方法
<body>
<h1><center>人员添加后信息列表</center></h1><br><hr>
<%
request.setCharacterEncoding("utf-8");
%>
<%
String driver="oracle.jdbc.driver.OracleDriver";
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String uname="scott";
String password="tiger";
Connection conn=null;
Statement stmt=null;
%>
<%
try {
Class.forName(driver);
conn= DriverManager.getConnection(url,uname,password);
stmt=conn.createStatement();
conn.setAutoCommit(false);
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.addBatch("insert into reyuan (name,age,tel) values ('love',3,5)");
stmt.executeBatch();
conn.commit();
%>
<%
}catch(Exception e){
try{
conn.rollback();
stmt.close();
conn.close();
}catch(Exception ee){
}
e.printStackTrace();
}
%>
</body>
</html>