-
POI处理excel后,原来的内置内嵌对象(embed object)就打不开了 -- 在POI官方没找到方案。5
POI处理excel后,原来的内置内嵌对象(embed object)就打不开了 -- 在POI官方没找到方案。用excel打开内嵌对象时,报错 "cannot start the source application for this object".
I've tried both poi3.6 poi3.7 and poi3.8. it's NOT working.
简单的代码段:
//read the temaplate excel with embed object
String filePathIn = "templdate.xls";
fs = new POIFSFileSystem(new FileInputStream(filePathIn));
HSSFWorkbook wb = new HSSFWorkbook(fs);
//write the templdate excel into output file
String filePathOut="out.xls";
FileOutputStream fileOut = new FileOutputStream(filePathOut);
wb.write(fileOut);
fileOut.close();
大家看看,谢谢2012年8月22日 16:06
3个答案 按时间排序 按投票排序
-
poi的操作实例可参考以下官方文档
http://poi.apache.org/spreadsheet/quick-guide.html
Embedded Objects部分在最后面2012年8月23日 09:50
-
通过下面代码获取excel中的内嵌对象
for (HSSFObjectData obj : wb.getAllEmbeddedObjects()) { //the OLE2 Class Name of the object String oleName = obj.getOLE2ClassName(); if (oleName.equals("Worksheet")) { DirectoryNode dn = (DirectoryNode) obj.getDirectory(); HSSFWorkbook embeddedWorkbook = new HSSFWorkbook(dn, fs, false); //System.out.println(entry.getName() + ": " + embeddedWorkbook.getNumberOfSheets()); } else if (oleName.equals("Document")) { DirectoryNode dn = (DirectoryNode) obj.getDirectory(); HWPFDocument embeddedWordDocument = new HWPFDocument(dn, fs); //System.out.println(entry.getName() + ": " + embeddedWordDocument.getRange().text()); } else if (oleName.equals("Presentation")) { DirectoryNode dn = (DirectoryNode) obj.getDirectory(); SlideShow embeddedPowerPointDocument = new SlideShow(new HSLFSlideShow(dn, fs)); //System.out.println(entry.getName() + ": " + embeddedPowerPointDocument.getSlides().length); } else { if(obj.hasDirectoryEntry()) { // The DirectoryEntry is a DocumentNode. Examine its entries to find out what it is DirectoryNode dn = (DirectoryNode) obj.getDirectory(); for (Iterator entries = dn.getEntries(); entries.hasNext();) { Entry entry = (Entry) entries.next(); //System.out.println(oleName + "." + entry.getName()); } } else { // There is no DirectoryEntry // Recover the object's data from the HSSFObjectData instance. byte[] objectData = obj.getObjectData(); } } }
2012年8月23日 09:46
相关推荐
poi excel poi excel poi excel poi excel poi excel poi excel poi excel poi excel
POI处理 excel2007
POI生成Excel POI读取Excel java操作Excel Servlet生成Excel web项目,包含含读取Excel与生成Excel方法
Javapoi对excel的文档处理,对时间日期的格式一些方法
poi读写excel,poi总结; poi读写excel,poi总结 poi读写excel,poi总结
POI向excel中插入图片
可以运行的POI导出Excel文件实例,里面有两种方法,一个是Servlet,一个是main
POI 删除excel列,可以设置多列,POI里怎么没有删除列的API呢
基于新版本的POI编写的读取Excel文件数据的工具类,可根据绝对路径、File对象、InputSteam对象读取解析Excel文件内容,并返回List<List<String>>格式结果,其中包含对单元格公式的处理。
利用POI读取excel写入到word 利用POI读取excel写入到word 利用POI读取excel写入到word,压缩包里包含了jar包
Poi导出Excel工具类 支持大数据量 多sheet页方式 已经封装好,直接拿来调用里面的方法传入参数就行 很简单
poi操作excel所需jar包及poi源码 包含内容 poi-3.7.jar poi-ooxml-3.7.jar poi-ooxml-schemas-3.7.jar poi-scratchpad-3.7.jar Lib-->commons-logging-1.1.jar lib-->junit-3.8.1.jar lib-->log4j.1.2.13.jar ooxml-...
POI读写excel文件+poi简单文档; POI读写excel文件+poi简单文档。
JAVA IO操作 POI读取excel的内容
ava解析Excel(兼容2003及2007):解析2003及以下使用HSSFWorkbook类, 解析2007及以上使用XSSFWorkbook, 如果解析类与excel版本不对应,抛出相应的异常,例如HSSFWorkbook解析2007: org.apache.poi.poifs....
使用poi生成Excel所需要的jar包,poi-3.9.jar
poi--4.导入excelpoi--4.导入excelpoi--4.导入excelpoi--4.导入excelpoi--4.导入excelpoi--4.导入excel
poi 操作excel模板,读取数据后,讲数据填充到新生成的文件中且提供下载
附件是java poi 3.17的lib库及其依赖库,全部下载引用后,可以进行excel的读写操作,无需引用其他lib库。poi-3.17适用于jdk1.7。 Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程序对Microsoft ...
这个是java用poi操作Excel进行导出,并且可以自动换行