我使用读取office03的方法来读取07的potx文件
代码如下
SlideShow ss = new SlideShow(new HSLFSlideShow(p));
// 得到源文件中的幻灯片数量
Slide[] slides = ss.getSlides();
for (int a = 0; a < slides.length; a++) {
// 为了取得幻灯片的文字内容,建立TextRun
TextRun[] tr = slides[a].getTextRuns();
for (int i = 0; i < tr.length; i++) {
// 将内容循环写入到txt文档中
new AddTxt().addtxt(path, pot, tr[i].getText(), true);
}
代码异常为
[color=red]org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
at org.apache.poi.poifs.storage.HeaderBlockReader.(HeaderBlockReader.java:111)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.(POIFSFileSystem.java:151)
at org.apache.poi.hslf.HSLFSlideShow.(HSLFSlideShow.java:103)
at org.apache.poi.hslf.HSLFSlideShow.(HSLFSlideShow.java:91)[/color]
最好有具体代码