[文件] Com_import.java ~ 4KB 下载(8) package com.service.compare;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.poi.hssf.eventmodel.EventRecordFactory;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import com.service.upfile.Link_Database;
public class Com_import {
private Connection conn = null;
PreparedStatement pstmt = null;
public void connect() {
try {
Link_Database demo = new Link_Database();
conn = demo.connect();
} catch (Exception e) {
e.printStackTrace();
}
}
public void close() {
try {
this.conn.close();
} catch (Exception e) {
}
}
public void test(String path,String xmb_bm,String charge_date){
List list = new ArrayList ();
try {
//OPCPackage pkg = OPCPackage.open(path);
InputStream is = new FileInputStream(path);
Workbook wb = WorkbookFactory.create(new File(path));
Sheet sheet = wb.getSheetAt(0);
for(int i = 0; i
转载于:https://my.oschina.net/u/947963/blog/111496