日期:2014-05-17 浏览次数:20731 次
import java.io.*; import jxl.*; public class ReadXLS { public static void main(String args[]){ try{ Workbook book=Workbook.getWorkbook(new File("产品分类.map.xls")); Sheet sheet=book.getSheet(0); for(int i=1;i<sheet.getRows();i++){ Cell c=sheet.getCell(5,i); System.out.println(sheet.getCell(5,i).getContents()); } book.close(); }catch(Exception e){ System.out.println(e); } } }
import java.io.*; import java.net.HttpURLConnection; import java.net.*; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; public class URLUtil { public static String getHtml(String urlString){ try{ StringBuffer html= new StringBuffer(); URL url=new URL(urlString); HttpURLConnection conn=(HttpURLConnection)url.openConnection(); InputStreamReader isr=new InputStreamReader(conn.getInputStream()); BufferedReader br = new BufferedReader(isr); String temp; while((temp = br.readLine())!=null){ html.append(temp).append("\n"); } br.close(); isr.close(); return html.toString(); }catch (Exception e){ e.printStackTrace(); return null; } } public static void main(String[] args){ System.out.println(URLUtil.getHtml("http://www.baidu.com")); } }
import java.io.*; import jxl.*; public class ReadXLS { public void call(){ try{ Workbook book=Workbook.getWorkbook(new File("产品分类.map.xls")); Sheet sheet=book.getSheet(0); for(int i=1;i<sheet.getRows();i++){ Cell c=sheet.getCell(5,i); System.out.println(sheet.getCell(5,i).getContents()); } book.close(); }catch(Exception e){ System.out.println(e); } } }