package com.test; import java.io.FileOutputStream; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import com.meterware.httpunit.GetMethodWebRequest; import com.meterware.httpunit.WebConversation; import com.meterware.httpunit.WebRequest; import com.meterware.httpunit.WebResponse; import com.meterware.httpunit.WebTable; public class Main { public static void main(String[] args) throws Exception { WebConversation wc = new WebConversation(); WebRequest request = new GetMethodWebRequest( "http://www.javaniu.com/table.html"); WebResponse response = wc.getResponse(request); WebTable table = response.getTables()[0]; Workbook wb = new HSSFWorkbook(); Sheet sheet = wb.createSheet("table2excel"); int rowCount = table.getRowCount(); int columnCount = table.getColumnCount(); for (int i = 0; i < rowCount; i++) { Row row = sheet.createRow(i); for (int j = 0; j < columnCount; j++) { System.out.println(table.getCellAsText(i, j)); row.createCell(j).setCellValue(table.getCellAsText(i, j)); } } FileOutputStream fileOut = new FileOutputStream("c:/workbook.xls"); wb.write(fileOut); fileOut.close(); } }

业务管理 LV7
2021年1月28日
645274617 LV1
2020年9月27日
EdgarLi LV14
2020年8月6日
1790158789 LV1
2020年1月10日
苦中苦 LV2
2019年11月18日
pjd6086860 LV4
2019年11月1日
kakaliu LV2
2019年9月13日
qufujunAQ LV5
2019年8月30日
wangxiaozhe99 LV1
2019年8月2日
kong.yee LV40
2019年7月30日