代码:
import java.io.*;
import java.util.*;
import jxl.*;
import jxl.read.biff.BiffException;
public class ReadExcel{
public static void main(String[] args) {
try {
Workbook book = Workbook.getWorkbook(new File("1.xls"));
Sheet sheet = book.getSheet(0);
System.out.println("请输入要读取的单元格");
Scanner in = new Scanner(System.in);
int x = in.nextInt();
in = new Scanner(System.in);
int y = in.nextInt();
Cell cell1 = sheet.getCell(x,y);
if (cell1.getType() == CellType.NUMBER) {
NumberCell nc = (NumberCell) cell1;
System.out.println("value : " + nc.getValue());
System.out.println("type : " + cell1.getType());
System.out.println("Format : " + cell1.getCellFormat());
System.out.println("NumberFormat: " + nc.getNumberFormat());
System.out.println("Font" + cell1.getCellFeatures());
System.out.println("Colum "+ cell1.getColumn());
System.out.println("Class "+ nc.getClass());
System.out.println("");
}
else {
System.out.println("Cell(x, y)" + " value : " + cell1.getContents()
-
"; type : " + cell1.getType()+"Format"+cell1.getCellFormat() );
}book.close();
} catch (BiffException e) {
// TODO 自动生成 catch 块
System.out.println(e);
} catch (IOException e) {
// TODO 自动生成 catch 块
System.out.println(e);;
}}
}
输出:
请输入要读取的单元格
3
3
value : 67.0
type : Number
Format : jxl.biff.XFRecord@1ac33c92
NumberFormat: java.text.DecimalFormat@7d1f1
Fontnull
Colum 3
Class class jxl.read.biff.NumberValue
问题:
为什么Format : jxl.biff.XFRecord@1ac33c92
NumberFormat: java.text.DecimalFormat@7d1f1
这两个输出这些啊?是什么?