本文整理匯總了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.createInformationProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java HSSFWorkbook.createInformationProperties方法的具體用法?Java HSSFWorkbook.createInformationProperties怎麽用?Java HSSFWorkbook.createInformationProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.poi.hssf.usermodel.HSSFWorkbook
的用法示例。
在下文中一共展示了HSSFWorkbook.createInformationProperties方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: makeDocInfo
import org.apache.poi.hssf.usermodel.HSSFWorkbook; //導入方法依賴的package包/類
private void makeDocInfo ( final HSSFWorkbook workbook )
{
workbook.createInformationProperties ();
final DocumentSummaryInformation dsi = workbook.getDocumentSummaryInformation ();
dsi.setCompany ( "Eclipse SCADA Project" );
final CustomProperties cp = new CustomProperties ();
cp.put ( "Eclipse SCADA Export Version", Activator.getDefault ().getBundle ().getVersion ().toString () );
dsi.setCustomProperties ( cp );
}
示例2: 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);
}
}
}