wps Office 2013个人版 - 轻松办公从金山wps2013开始!

金山wps

当前位置: 主页 > excel2003 >

java 读取 Excel 读取 兼容2003,2007

时间:2013-09-17 03:37来源:曾经过去 作者:桃源野夫 点击:

   list.add(linked);

return list;

linked.add(value);

continue;

if (value == null ||"".equals(value)) {

value = cell.toString();

System.out.println(i+"2003行"+j+" 列 is default type");

default:

break;

value = "";

System.out.println(i+"行"+j+" 列 is Blank type");

case XSSFCell.CELL_TYPE_BLANK:

break;

value = cell.getBooleanCellValue();

System.out.println(i+"听听excel2003安装包行"+j+" 列 is Boolean type");

case XSSFCell.CELL_TYPE_BOOLEAN:

break;

value = sdf.format(HSSFDateUtil.getJavaDate(cell.getNumericCellValue()));

}else{

value = nf.format(cell.getNumericCellValue());

} else if("General".equals(cell.getCellStyle().getDataFormatString())){

value = df.format(cell.getNumericCellValue());

if("@".equals(cell.getCellStyle().getDataFormatString())){

System.out.println(i+"对比一下读取行"+j+" 列 is Number type ; DateFormt:"+cell.getCellStyle().getDataFormatString());

case XSSFCell.CELL_TYPE_NUMERIC:

break;

value = cell.getStringCellValue();

System.out.println(i+"行"+j+" 列 is String type");

case XSSFCell.CELL_TYPE_STRING:

switch (cell.getCellType()) {

DecimalFormat nf = new DecimalFormat("0.00");// 看看怎样下载excel2003格式化数字

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 格式化日期字符串

DecimalFormat df = new DecimalFormat("0");// 格式化 number String 字符

continue;

if (cell == null) {

cell = row.getCell(j);

for (int j = row.getFirstCellNum(); j <= row.getLastCellNum(); j++) {

List<Object> linked = new LinkedList<Object>();

continue;

if (row == null) {

row = sheet.getRow(i);

.getPhysicalNumberOfRows(); i++) {

for (int i = sheet.getFirstRowNum(); i <= sheet

XSSFCell cell = null;

XSSFRow row = null;

Object value = null;

XSSFSheet sheet = xwb.getSheetAt(0);

// 读取读取第一章表格内容

XSSFWorkbook xwb = new XSSFWorkbook(new FileInputStream(file));

// 构造 XSSFWorkbook 对象,至少要这几种

List<List<Object>> list = new LinkedList<List<Object>>();

private static List<List<Object>> read2007Excel(File file) throws IOException {

* */

* 读取读取Office 2007 excel

return list;

list.add(linked);

linked.add(value);

continue;

if (value == null ||"".equals(value)) {

value = cell.toString();

System.out.println(i+"excel行"+j+" 列 is default type");

default:

break;

value = "";

System.out.println(i+"行"+j+" 列 is Blank type");

case XSSFCell.CELL_TYPE_BLANK:

break;

value = cell.getBooleanCellValue();

System.out.println(i+"行"+j+" 列 is Boolean type");

case XSSFCell.CELL_TYPE_BOOLEAN:

break;

value = sdf.format(HSSFDateUtil.getJavaDate(cell.getNumericCellValue()));

}else{

value = nf.format(cell.getNumericCellValue());

} else if("General".equals(cell.getCellStyle().getDataFormatString())){

value = df.format(cell.getNumericCellValue());

if("@".equals(cell.getCellStyle().getDataFormatString())){

System.out.println(i+"excel2003教程下载行"+j+" 列 is Number type ; DateFormt:"+cell.getCellStyle().getDataFormatString());

case XSSFCell.CELL_TYPE_NUMERIC:

break;

value = cell.getStringCellValue();

System.out.println(i+"行"+j+" 列 is String type");

case XSSFCell.CELL_TYPE_STRING:

switch (cell.getCellType()) {

DecimalFormat nf = new DecimalFormat("0.00");// 对比一下excel2003使用教程格式化数字

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 格式化日期字符串

DecimalFormat df = new DecimalFormat("0");// 格式化 number String 字符

continue;

if (cell == null) {

cell = row.getCell(j);

for (int j = row.getFirstCellNum(); j <= row.getLastCellNum(); j++) {

List<Object> linked = new LinkedList<Object>();

continue;

if (row == null) {

row = sheet.getRow(i);

for(int i = sheet.getFirstRowNum();i<= sheet.getPhysicalNumberOfRows();i++){

HSSFCell cell = null;

HSSFRow row = null;

Object value = null;

HSSFSheet sheet = hwb.getSheetAt(0);

HSSFWorkbook hwb = new HSSFWorkbook(new FileInputStream(file));

List<List<Object>> list = new LinkedList<List<Object>>();

private static List<List<Object>> read2003Excel(File file) throws IOException{

* @throws FileNotFoundException */

* @throws IOException

* 兼容读取 office 2003 excel

throw new IOException("不支持的文件类型");

}else{

return read2007Excel(file);

}else if("xlsx".equals(extension)){

return read2003Excel(file);

if("xls".equals(extension)){

String extension = stIndexOf(".")==-1?"":fileName.substring(stIndexOf(".")+1);

String fileName = file.getName();

public static List<List<Object>> readExcel(File file) throws IOException{

* */

* 听听java对外提供读取excel 的方法

e.printStackTrace();

} catch (IOException e) {

System.out.println(one.get(3));

System.out.println(one.get(2));

System.out.println(one.get(1));

System.out.println(one.get(0));

Li我不知道Excelst one = (List) list.get(i);

for (int i = 0; i < list.size(); i++) {

List list = readExcel(file);

try {

File file = new File("D:\\Tomcat 6\\webapps\\export\\upload\\Book1.xlsx");

public static void main(String[] args) {

public class 你知道2007ExcelUtil {

import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import org.apache.poi.xssf.usermodel.XSSFSheet;

import org.apache.poi.xssf.usermodel.XSSFRow;

import org.apache.poi.xssf.usermodel.XSSFCell;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;

import org.apache.poi.hssf.usermodel.HSSFSheet;

import org.apache.poi.hssf.usermodel.HSSFRow;

import org.apache.poi.hssf.usermodel.HSSFDateUtil;

import org.apache.poi.hssf.usermodel.HSSFCell;

import java.util.List;

import java.util.LinkedList;

import java.text.SimpleDateFormat;

import java.text.DecimalFormat;

import java.io.IOException;

import java.io.FileNotFoundException;

import java.io.FileInputStream;

import java.io.File;

package com.yiwanj.core.util;

xmlbeans-2.3.0.jar

poi-ooxml-schemas-3.7-.jar

poi-ooxml-3.7-.jar

poi-3.7-.jar

对于excel2003打开xlsx需要jar包 ,相比看[转] 各种软件视频教学(强力推荐绝对有用不管你学的是什么专业)excel2003兼容2007


excel2003表格
读取
看着Excel
读取
兼容2003
word excel2excel2003冻结窗口003
想知道怎样下载excel2003
excel2003基础教程
看着兼容2003
我不知道哪里下载excel2003
java
听说读取
事实上excel2003表格下载
看着excel2003教程全集
2007
2007
excel2003excel2003安装程序打开xlsx
excel2003宏教程
听说怎么下载excel2003
听说java

(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
验证码: 点击我更换图片
栏目列表
推荐内容