请问如何把excel的东西转换成html文档(最好有代码) 请问如何把excel的东西转换成html文档(最好有代码) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先解析读取excel数据,然后用JAVA代码输出html源文件的形式输出.读取excel: try { Workbook book = Workbook.getWorkbook(new File("c:\\aaa.xls")); // 获得第一个工作表对象 Sheet sheet = book.getSheet(0); // 得到第一列第一行的单元格 Demo1 d1 = new Demo1(); for(int i=1;i<131;i++){ Cell cell1 = sheet.getCell(3,i); Cell cell2 = sheet.getCell(5,i); Cell cell3 = sheet.getCell(7,i); Cell cell4 = sheet.getCell(0,i); Cell cell5 = sheet.getCell(1,i); String cell1_1 = cell1.getContents().trim(); String cell2_1 = cell2.getContents().trim(); String cell5_1 = cell5.getContents().trim(); String cell3_1 = null; cell3_1 // System.out.println(cell4_1 + "::" +cell1_1 + "::" + cell2_1 + "::" + cell3_1);= cell3.getContents().trim(); String cell4_1 = cell4.getContents().trim(); d1.gets(cell4_1,cell5_1,cell1_1,cell2_1,cell3_1); System.out.println(cell1_1.length()); } book.close(); } catch (Exception e) { System.out.println(e); } } 再输出html源文件try { file2.createNewFile();// 创建文件 sb.append("<head>"); sb .append("<meta http-equiv='content-type' content='text/html; charset=UTF-8'>"); sb.append("\n"); sb.append("<title>aaaaaaa</title>"); sb.append("\n"); // ******************************css样式Str**************************************** sb.append("<style type='text/css'>"); sb.append("\n"); sb.append(".tablerow0 {background: #EEEEEE;}"); sb.append("\n");…………………………………………………………………………………………………………………………………………………………………………………………………………………… java c/s模式线程JDBC问题 求助:filechooser中怎么对文件选择对话框上到打开按钮设置动作 java 邮件附件中文乱码! 帮帮忙!! 请问一下递归的用法要注意什么?? 怎么用正则表达式判断一个字符串中有指定字符??? 跪求带秒表功能的时钟代码,急! 在JNI中频繁的调用本地方法,会耗尽虚拟内存吗 JAVA包的困惑(在线等待) 送分大讨论:数据显式应该在什么时候完成? jdbc连接oracle仍然报错 我的csdn的bolg被停了!
读取excel:
try {
Workbook book = Workbook.getWorkbook(new File("c:\\aaa.xls"));
// 获得第一个工作表对象
Sheet sheet = book.getSheet(0);
// 得到第一列第一行的单元格
Demo1 d1 = new Demo1();
for(int i=1;i<131;i++){
Cell cell1 = sheet.getCell(3,i);
Cell cell2 = sheet.getCell(5,i);
Cell cell3 = sheet.getCell(7,i);
Cell cell4 = sheet.getCell(0,i);
Cell cell5 = sheet.getCell(1,i);
String cell1_1 = cell1.getContents().trim();
String cell2_1 = cell2.getContents().trim();
String cell5_1 = cell5.getContents().trim();
String cell3_1 = null;
cell3_1
// System.out.println(cell4_1 + "::" +cell1_1 + "::" + cell2_1 + "::" + cell3_1);= cell3.getContents().trim();
String cell4_1 = cell4.getContents().trim();
d1.gets(cell4_1,cell5_1,cell1_1,cell2_1,cell3_1);
System.out.println(cell1_1.length());
}
book.close();
} catch (Exception e) {
System.out.println(e);
}
}
try {
file2.createNewFile();// 创建文件
sb.append("<head>");
sb
.append("<meta http-equiv='content-type' content='text/html; charset=UTF-8'>");
sb.append("\n");
sb.append("<title>aaaaaaa</title>");
sb.append("\n");
// ******************************css样式Str****************************************
sb.append("<style type='text/css'>");
sb.append("\n");
sb.append(".tablerow0 {background: #EEEEEE;}");
sb.append("\n");
……………………………………………………………………………………………………………………………………………………………………………………………………………………