¶ÁÈ¡excel£¨POI£©¡¾×ª»»Îªhtml¡¿
package test;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFPalette;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
public class POIReadExcel {
public static void main(String[] args){
try {
POIReadExcel poire = new POIReadExcel();
String path = "D:\\test.xls";
File sourcefile = new File(path);
InputStream is = new FileInputStream(sourcefile);
POIFSFileSystem fs = new POIFSFileSystem( is );
HSSFWorkbook wb = new HSSFWorkbook(fs);
System.out.println(poire.getExcelInfo(wb));
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public String getExcelInfo(HSSFWorkbook wb) throws Exception{
StringBuffer sb = new StringBuffer();
Sheet sheet = wb.getSheetAt(0);
int lastRowNum = sheet.getLastRowNum();
Map<String,String> map[] = getRowSpanColSpanMap(sheet);
sb.append("<table border='0' cellspacing='1' width='100%'>");
HSSFRow row = null;
&nbs
Ïà¹ØÎĵµ£º
HTMLÓïÑÔÓï·¨´óÈ«
<! - - ... - -> Åú×¢
<!> ÅÜÂíµÆ
<marquee>...</marquee>ÆÕͨ¾í¶¯
<marquee behavior=slide>...</marquee>»¬¶¯
<marquee behavior=scroll>...</marquee>Ô¤Éè¾í¶¯
<marquee behavior=alternate>...</marquee>À´»Ø¾í¶¯
& ......
½ñÌ죬×öÏîÄ¿µÄʱºòͻȻ¿´µ½<a target="_blank"></a>Õâ¸ö,¾ÍÍøÉϲéѯÁËÏ ¾ßÌåÈçÏ£¬»¹Ñ§µ½ÆäËû¶îÍâµÄ֪ʶ£¬(*^__^*) ÎûÎû……
targetÊÇ´ò¿ªÁ´½ÓʱÓÃʲôĿ±ê´ò¿ª£¬ÊÇÔÚд°¿ÚÖдò¿ª¾ÍÓÃtarget=_blank£¬ÔÚ¸¸´°¿ÚÖдò¿ª¾ÍÓÃtarget=_parent£¬ÔÚµ±Ç°´°¿ÚÖдò¿ª¾ÍÓÃtarget=_self,
target=_top±íʾÔÚ¶ ......
¼¸ºõÿ¸ö»áÔ±ÖÆÍøÕ¾¶¼ÐèҪͨ¹ýºǫ́·¢ËÍÓʼþÀ´Óë»áÔ±½øÐйµÍ¨£¬Èç×¢²áÈ·ÈÏ¡¢ÓªÏúÍƹ㡣ÕâЩÓÉÕ¾·½·¢¸ø»áÔ±µÄÐżþ£¬ÍùÍù´¿Îı¾¸ñʽÒѲ»ÄÜÂú×ã½çÃæºÍ½»»¥µÄÒªÇó£¬ÕâʱºòÎÒÃǾÍÐèÒª·¢ËÍHTMLÒ³Ãæ¡£ÓÉÓÚHTMLÓʼþ²»ÊǶÀÁ¢µÄHOSTÔÚ±¾Õ¾µÄÒ³Ã棬ÊǼÄÈËÀéϵġ£ËùÒÔ±àдHTMLÓʼþÓë±àдHTMLÒ³ÃæÓкܴóµÄ²»Í¬¡£ÒòΪ£¬¸÷ÃæÏòÍøÃñµÄÖ÷Á÷ÓÊ ......