feleon的gravatar头像
feleon 2013-01-16 10:06:23

java poi读取excel

详情看java代码上传,希望对各位有帮助!

public static void main(String[] args) {
		try {
			// 对读取Excel表格标题测试
			ReadExcel excelReader = new ReadExcel();
			InputStream is = new FileInputStream("D:/a1.xls");
			String[] title = excelReader.readExcelTitle(is);
			System.out.println("获得Excel表格的标题:");
			for (String s : title) {
				System.out.print(s + "    ");
			}

			// 对读取Excel表格内容测试
			InputStream is2 = new FileInputStream("D:/a1.xls");
			Map<Integer, String> map = excelReader.readExcelContent(is2);
			System.out.println("\n" + "获得Excel表格的内容:");
			for (int i = 1; i <= map.size(); i++) {
				System.out.println(map.get(i));
			}

		} catch (FileNotFoundException e) {
			System.out.println("未找到指定路径的文件!");
			e.printStackTrace();
		}
	}


AXIN编辑于2014-2-13 15:52:41


最代码官方编辑于2014-10-19 10:24:30


打赏

文件名:ReadExcel.java,文件大小:6K 下载
最代码最近下载分享源代码列表最近下载
felix1997  LV1 2021年11月19日
whfuai  LV14 2021年8月9日
cxycxy  LV9 2021年6月4日
我是helloworld  LV23 2021年4月18日
luouluoluou  LV1 2020年7月30日
hetaotao  LV2 2020年7月26日
wjh12345654321  LV14 2020年7月17日
lxzsuper  LV12 2020年4月16日
渣渣辉  LV11 2020年2月6日
gf8480  LV1 2019年11月9日
最代码最近浏览分享源代码列表最近浏览
吞吞吐吐她  LV4 昨天
floweyws  LV6 2月5日
微信网友_6411774242443264 2023年11月27日
暂无贡献等级
萌新不想挨打 2022年9月3日
暂无贡献等级
我不划水 2022年4月24日
暂无贡献等级
gaotieyou  LV5 2022年3月18日
2607825144qq  LV3 2021年12月8日
地方撒地方的  LV2 2021年12月7日
Yanxigul 2021年12月2日
暂无贡献等级
李海洋  LV12 2021年11月23日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友