当前位置: 首页>>代码示例>>Java>>正文


Java HSSFWorkbook.getSummaryInformation方法代码示例

本文整理汇总了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.getSummaryInformation方法的典型用法代码示例。如果您正苦于以下问题:Java HSSFWorkbook.getSummaryInformation方法的具体用法?Java HSSFWorkbook.getSummaryInformation怎么用?Java HSSFWorkbook.getSummaryInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.hssf.usermodel.HSSFWorkbook的用法示例。


在下文中一共展示了HSSFWorkbook.getSummaryInformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareHSSFMetaData

import org.apache.poi.hssf.usermodel.HSSFWorkbook; //导入方法依赖的package包/类
/**
*
* Write metadata into HSSF document
*
*/
private void prepareHSSFMetaData() {
	HSSFWorkbook currentHSSFWorkbook = (HSSFWorkbook) this.currentWorkbook;
	SummaryInformation summaryInfo = currentHSSFWorkbook.getSummaryInformation(); 
	if (summaryInfo==null) {
		currentHSSFWorkbook.createInformationProperties();
		 summaryInfo = currentHSSFWorkbook.getSummaryInformation(); 
	}
	SimpleDateFormat formatSDF = new SimpleDateFormat(MSExcelParser.DATE_FORMAT); 
	for (Map.Entry<String,String> entry: this.howc.getMetadata().entrySet()) {
		// process general properties
		try {
		switch(entry.getKey()) {
			case "applicationname": 
				summaryInfo.setApplicationName(entry.getValue()); 
				break;
			case "author": 
				summaryInfo.setAuthor(entry.getValue()); 
				break;
			case "charcount": 
				summaryInfo.setCharCount(Integer.parseInt(entry.getValue())); 
				break;
			case "comments": 
				summaryInfo.setComments(entry.getValue()); 
				break;
			case "createdatetime": 
				summaryInfo.setCreateDateTime(formatSDF.parse(entry.getValue())); 
				break;
			case "edittime": 
				summaryInfo.setEditTime(Long.parseLong(entry.getValue())); 
				break;
			case "keywords": 
				summaryInfo.setKeywords(entry.getValue()); 
				break;
			case "lastauthor": 
				summaryInfo.setLastAuthor(entry.getValue()); 
				break;
			case "lastprinted": 
				summaryInfo.setLastPrinted(formatSDF.parse(entry.getValue())); 
				break;	
			case "lastsavedatetime": 
				summaryInfo.setLastSaveDateTime(formatSDF.parse(entry.getValue())); 
				break;
			case "pagecount": 
				summaryInfo.setPageCount(Integer.parseInt(entry.getValue())); 
				break;
			case "revnumber": 
				summaryInfo.setRevNumber(entry.getValue()); 
				break;
			case "security": 
				summaryInfo.setSecurity(Integer.parseInt(entry.getValue())); 
				break;
			case "subject": 
				summaryInfo.setSubject(entry.getValue()); 
				break;
			case "template": 
				summaryInfo.setTemplate(entry.getValue()); 
				break;	
			case "title": 
				summaryInfo.setTitle(entry.getValue()); 
				break;
			case "wordcount": 
				summaryInfo.setWordCount(Integer.parseInt(entry.getValue())); 
				break;
			default: 
				LOG.warn("Unknown metadata key: "+entry.getKey()); 
				break;	
		} 
		} catch (ParseException pe) {
			LOG.error(pe);
		}

	}
}
 
开发者ID:ZuInnoTe,项目名称:hadoopoffice,代码行数:79,代码来源:MSExcelWriter.java


注:本文中的org.apache.poi.hssf.usermodel.HSSFWorkbook.getSummaryInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。