¶ÁÈ¡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
Ïà¹ØÎĵµ£º
¶ÔÓÚ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") ......
½ñÌ죬×öÏîÄ¿µÄʱºòͻȻ¿´µ½<a target="_blank"></a>Õâ¸ö,¾ÍÍøÉϲéѯÁËÏ ¾ßÌåÈçÏ£¬»¹Ñ§µ½ÆäËû¶îÍâµÄ֪ʶ£¬(*^__^*) ÎûÎû……
targetÊÇ´ò¿ªÁ´½ÓʱÓÃʲôĿ±ê´ò¿ª£¬ÊÇÔÚд°¿ÚÖдò¿ª¾ÍÓÃtarget=_blank£¬ÔÚ¸¸´°¿ÚÖдò¿ª¾ÍÓÃtarget=_parent£¬ÔÚµ±Ç°´°¿ÚÖдò¿ª¾ÍÓÃtarget=_self,
target=_top±íʾÔÚ¶ ......
¶ÔÓÚ¸Õ¸Õ½Ó´¥HTMLÔ´´úÂëµÄÅóÓÑ¿ÉÄÜÓÐÕâÑùÒ»¸öÒÉ»ó£ºÔÚÒ»¸ö±íµ¥ÔªËØÖУ¬ÎÒÈç¹ûÏëÓýű¾È·¶¨Ä³¸ö¾ßÌåÔªËØ£¬ÎҼȿÉÒÔÓÃËûµÄNAMEÀ´Ë÷ÒýÕâ¸ö¶ÔÏó£¬Ò²¿ÉÒÔ¼ÓÒ»¸öIDÀ´Ë÷ÒýËü£¬ÄÇÕâÁ½ÖÖ·½·¨¾¿¾¹ÓÐÊ²Ã´Çø±ðÄØ£¿ÒÔÏÂÎÒÃÇÀ´¾ßÌå̽ÌÖһϣ¬¼øÓÚ±¾ÈËˮƽÓÐÏÞ£¬ÈçÓÐÃèÊö²»µ±£¬¿ÒÇëÖ¸½Ì¡£
ÎÒÃÇ¿ÉÒÔͨ¹ýÒ»¶Î´úÂëÀ´·ÖÎöÒ»ÏÂÆäÖеÄ΢Ãî²î±ð:
......
Ä£°åµÄhtml ¸ñʽÈçÏ£º
<div id="itemTemplate" style="display:none">
<div class='hotl'>
<div class='l'>
<a href='__ProUrl__'><img src='__ImgUrl__' alt='__ProName__' /></a>
</div>
<ul class='r'>
<li><a href='__ProUrl__' ......
¿òÏßÖÆ×÷³£ÓôúÂë
´úÂë
º¬Òå
<table>...</table>
½¨Á¢±í¸ñ£¬ËùÓÐµÄÆäËû±ê¼Ç¶¼ÐèÒªÔڴ˱ê¼ÇÖÐ
<table width=* heigth=*></table>
É趨±í¸ñ¿í¶ÈwidthºÍ¸ß¶Èheight£¬ÊôÐÔÖµ¿ÉÒÔʹÓõãÊý£¬È磺width=50£¬Ò²¿ÉÒÔʹÓðٷֱȣ¬È磺width=50%¡£
<table bgcolor=*></ta ......