本文整理了Java中org.apache.poi.hwpf.HWPFDocument.getSummaryInformation()
方法的一些代码示例,展示了HWPFDocument.getSummaryInformation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HWPFDocument.getSummaryInformation()
方法的具体详情如下:
包路径:org.apache.poi.hwpf.HWPFDocument
类名称:HWPFDocument
方法名:getSummaryInformation
暂无
代码示例来源:origin: stackoverflow.com
HWPFDocument document = [...];
SummaryInformation summaryInformation = document.getSummaryInformation();
System.out.println("GKPIDSI_CHARCOUNT: " + summaryInformation.getCharCount());
DocumentSummaryInformation documentSummaryInformation = document.getDocumentSummaryInformation();
Integer count = null;
for (Property property : documentSummaryInformation.getProperties()) {
if (property.getID() == 0x11) {
count = (Integer) property.getValue();
break;
}
}
System.out.println("GKPIDDSI_CCHWITHSPACES: " + count);
代码示例来源:origin: stackoverflow.com
String lowerFilePath = filePath.toLowerCase();
if (lowerFilePath.endsWith(".xls")) {
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(lowerFilePath));
Integer sheetNums = workbook.getNumberOfSheets();
if (sheetNums > 0) {
return workbook.getSheetAt(0).getRowBreaks().length + 1;
}
} else if (lowerFilePath.endsWith(".xlsx")) {
XSSFWorkbook xwb = new XSSFWorkbook(lowerFilePath);
Integer sheetNums = xwb.getNumberOfSheets();
if (sheetNums > 0) {
return xwb.getSheetAt(0).getRowBreaks().length + 1;
}
} else if (lowerFilePath.endsWith(".docx")) {
XWPFDocument docx = new XWPFDocument(POIXMLDocument.openPackage(lowerFilePath));
return docx.getProperties().getExtendedProperties().getUnderlyingProperties().getPages();
} else if (lowerFilePath.endsWith(".doc")) {
HWPFDocument wordDoc = new HWPFDocument(new FileInputStream(lowerFilePath));
return wordDoc.getSummaryInformation().getPageCount();
} else if (lowerFilePath.endsWith(".ppt")) {
HSLFSlideShow document = new HSLFSlideShow(new FileInputStream(lowerFilePath));
SlideShow slideShow = new SlideShow(document);
return slideShow.getSlides().length;
} else if (lowerFilePath.endsWith(".pptx")) {
XSLFSlideShow xdocument = new XSLFSlideShow(lowerFilePath);
XMLSlideShow xslideShow = new XMLSlideShow(xdocument);
return xslideShow.getSlides().length;
}
代码示例来源:origin: sakaiproject/sakai
private int wordDocLength(ContentResource resource) {
if (!serverConfigurationService.getBoolean("tii.checkWordLength", false))
return 100;
try {
POIFSFileSystem pfs = new POIFSFileSystem(resource.streamContent());
HWPFDocument doc = new HWPFDocument(pfs);
SummaryInformation dsi = doc.getSummaryInformation();
int count = dsi.getWordCount();
log.debug("got a count of " + count);
//if this == 0 then its likely that something went wrong -poi couldn't read it
if (count == 0)
return 100;
return count;
} catch (IOException e) {
log.error(e.getMessage(), e);
} catch (ServerOverloadException e) {
log.error(e.getMessage(), e);
}
//in case we can't read this lets err on the side of caution
return 100;
}
代码示例来源:origin: ModeShape/modeshape
metadata.setMetadata(document.getSummaryInformation());
return metadata;
代码示例来源:origin: org.modeshape/modeshape-sequencer-msoffice
metadata.setMetadata(document.getSummaryInformation());
return metadata;
代码示例来源:origin: uk.bl.wa.discovery/digipres-tika
System.out.println("ApplicationName: "+doc.getSummaryInformation().getApplicationName());
System.out.println("OSVersion: "+doc.getSummaryInformation().getOSVersion());
System.out.println("# paragraphs: "+doc.getDocumentSummaryInformation().getParCount());
System.out.println("# bytes: "+doc.getDocumentSummaryInformation().getByteCount());
代码示例来源:origin: ukwa/webarchive-discovery
System.out.println("ApplicationName: "+doc.getSummaryInformation().getApplicationName());
System.out.println("OSVersion: "+doc.getSummaryInformation().getOSVersion());
System.out.println("# paragraphs: "+doc.getDocumentSummaryInformation().getParCount());
System.out.println("# bytes: "+doc.getDocumentSummaryInformation().getByteCount());
内容来源于网络,如有侵权,请联系作者删除!