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 map[] = getRowSpanColSpanMap(sheet);
sb.append("
for(int row = 0; row < rownum; row ++) {
sb.append("
");for(int col = 0; col < colnum; col ++) {
Cell cell = sheet.getCell(col, row);
String content = cell.getContents();
&nbs