读取excel(JXL)【输出为html格式】
package test;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import jxl.Cell;
import jxl.Range;
import jxl.Sheet;
import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.CellFormat;
import jxl.format.Colour;
import jxl.format.VerticalAlignment;
public class JXLReadExcel {
public static void main(String[] args){
try {
System.out.println(getExcelInfo("D:\\businessStat1.xls"));
//getExcelInfo("D:\\businessStat1.xls");
//getProperties();
//toHexString();
} catch (Exception e) {
e.printStackTrace();
}
}
private static String getExcelInfo(String path) throws Exception{
StringBuffer sb = new StringBuffer();
File sourcefile = new File(path);
InputStream is = new FileInputStream(sourcefile);
Workbook rwb = Workbook.getWorkbook(is);
Sheet sheet = rwb.getSheet(0);
int colnum = sheet.getColumns();
int rownum = sheet.getRows();
Map<String,String> map[] = getRowSpanColSpanMap(sheet);
sb.append("<table border='0' cellspacing='1'>");
for(int row = 0; row < rownum; row ++) {
sb.append("<tr>");
for(int col = 0; col < colnum; col ++) {
Cell cell = sheet.getCell(col, row);
String content = cell.getContents();
&nbs
相关文档:
众所周知,对于链接和图片,我们可以通过添加title
属
性以显示一些说明文字,一般情况下,这些文字都是显示成一行,那么有没有办法让它以多行的方式显示呢?解决的方法有两种:
1.将title
属
性分成几行来写,例如:
<a href=#" title
="说明一
说明二
说明
三">印象派</a> ......
对于HTM网页,加入:
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="0">
然后,jsp页面中加入:
<%
response.setHeader("Cache-Control","no-store") ......
框线制作常用代码
代码
含义
<table>...</table>
建立表格,所有的其他标记都需要在此标记中
<table width=* heigth=*></table>
设定表格宽度width和高度height,属性值可以使用点数,如:width=50,也可以使用百分比,如:width=50%。
<table bgcolor=*></ta ......
<script type="text/javascript">
var count = 0;
function Add(){
count += 1;
var File1 = document.getElementById("file1");
var div = document.createElement("div");
var btnJiaHao = document.createElement(" ......