首页新闻找找看学习计划

poi 3.9 支持excel2010 2013(xlsx)的类或接口是哪个 没有找到XSSF类 !!

0
悬赏园豆:50 [已解决问题] 解决于 2013-09-22 13:21

poi 3.9 支持excel2010 2013(xlsx)的类或接口是哪个 没有找到XSSF类 !!

指间砂的主页 指间砂 | 初学一级 | 园豆:97
提问于:2013-09-22 10:39
< >
分享
最佳答案
0
收获园豆:50
````` | 专家六级 |园豆:14268 | 2013-09-22 10:49

看不懂啊  大哥  我不懂英文啊

指间砂 | 园豆:97 (初学一级) | 2013-09-22 11:21

@ゞ时光之砂ヽ: 

  XSSFWorkbook workbook = new XSSFWorkbook("excel_with_embeded.xlsx");
  for (PackagePart pPart : workbook.getAllEmbedds()) {
      String contentType = pPart.getContentType();
      // Excel Workbook - either binary or OpenXML
      if (contentType.equals("application/vnd.ms-excel")) {
          HSSFWorkbook embeddedWorkbook = new HSSFWorkbook(pPart.getInputStream());
      }
      // Excel Workbook - OpenXML file format
      else if (contentType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) {
          OPCPackage docPackage = OPCPackage.open(pPart.getInputStream());
          XSSFWorkbook embeddedWorkbook = new XSSFWorkbook(docPackage);
      }
      // Word Document - binary (OLE2CDF) file format
      else if (contentType.equals("application/msword")) {
          HWPFDocument document = new HWPFDocument(pPart.getInputStream());
      }
      // Word Document - OpenXML file format
      else if (contentType.equals("application/vnd.openxmlformats-officedocument.wordprocessingml.document")) {
          OPCPackage docPackage = OPCPackage.open(pPart.getInputStream());
          XWPFDocument document = new XWPFDocument(docPackage);
      }
      // PowerPoint Document - binary file format
      else if (contentType.equals("application/vnd.ms-powerpoint")) {
          HSLFSlideShow slideShow = new HSLFSlideShow(pPart.getInputStream());
      }
      // PowerPoint Document - OpenXML file format
      else if (contentType.equals("application/vnd.openxmlformats-officedocument.presentationml.presentation")) {
          OPCPackage docPackage = OPCPackage.open(pPart.getInputStream());
          XSLFSlideShow slideShow = new XSLFSlideShow(docPackage);
      }
      // Any other type of embedded object.
      else {
          System.out.println("Unknown Embedded Document: " + contentType);
          InputStream inputStream = pPart.getInputStream();
      }
  }
````` | 园豆:14268 (专家六级) | 2013-09-22 11:24

@imfunny: 没有XSSF这个接口啊   是poi3.9么

指间砂 | 园豆:97 (初学一级) | 2013-09-22 12:31

@ゞ时光之砂ヽ: 有啊 看看下面说的大于3.7以上的。看看SDK的解释啊。不行了拿google来翻译就

````` | 园豆:14268 (专家六级) | 2013-09-22 13:07

@imfunny: 好的  谢谢啊

指间砂 | 园豆:97 (初学一级) | 2013-09-22 13:20
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册