• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CoreProperties类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.poi.POIXMLProperties.CoreProperties的典型用法代码示例。如果您正苦于以下问题:Java CoreProperties类的具体用法?Java CoreProperties怎么用?Java CoreProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CoreProperties类属于org.apache.poi.POIXMLProperties包,在下文中一共展示了CoreProperties类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

import org.apache.poi.POIXMLProperties.CoreProperties; //导入依赖的package包/类
public cfData execute( cfSession _session, List<cfData> parameters ) throws cfmRunTimeException {
	if ( parameters.get(0).getDataType() != cfData.CFSTRUCTDATA )
		throwException(_session, "parameter must be of type structure");
	
	cfSpreadSheetData	spreadsheet	= (cfSpreadSheetData)parameters.get(1);
	cfStructData	s	= (cfStructData)parameters.get(0);
	
	Workbook	workbook	= spreadsheet.getWorkBook();
	
	/*
	 * XSSFWorkbook
	 */
	if ( workbook instanceof XSSFWorkbook ){
		XSSFWorkbook xSSFWorkbook = (XSSFWorkbook)workbook;
		
		CoreProperties cP = xSSFWorkbook.getProperties().getCoreProperties();
		
		if ( s.containsKey("author") )
			cP.setCreator( s.getData("author").getString() );
		if ( s.containsKey("category") )
			cP.setCategory( s.getData("category").getString() );
		if ( s.containsKey("subject") )
			cP.setSubjectProperty( s.getData("subject").getString() );
		if ( s.containsKey("title") )
			cP.setTitle( s.getData("title").getString() );
		if ( s.containsKey("revision") )
			cP.setRevision( s.getData("revision").getString() );
		if ( s.containsKey("description") )
			cP.setDescription( s.getData("description").getString() );
		 		
	}else{
		HSSFWorkbook hSSFWorkbook = (HSSFWorkbook)workbook;
		DocumentSummaryInformation dSummary = hSSFWorkbook.getDocumentSummaryInformation();
		
		if ( dSummary == null ){
			hSSFWorkbook.createInformationProperties();
			dSummary = hSSFWorkbook.getDocumentSummaryInformation();
		}
		
		if ( s.containsKey("category") )
			dSummary.setCategory( s.getData("category").getString() );
		if ( s.containsKey("manager") )
			dSummary.setManager( s.getData("manager").getString() );
		if ( s.containsKey("company") )
			dSummary.setCompany( s.getData("company").getString() );

		SummaryInformation sInformation = hSSFWorkbook.getSummaryInformation();
		
		if ( s.containsKey("title") )
			sInformation.setTitle( s.getData("title").getString() );
		if ( s.containsKey("subject") )
			sInformation.setSubject( s.getData("subject").getString() );
		if ( s.containsKey("author") )
			sInformation.setAuthor( s.getData("author").getString() );
		if ( s.containsKey("comments") )
			sInformation.setComments( s.getData("comments").getString() );
		if ( s.containsKey("keywords") )
			sInformation.setKeywords( s.getData("keywords").getString() );
		if ( s.containsKey("lastauthor") )
			sInformation.setLastAuthor( s.getData("lastauthor").getString() );
	}
	
	return cfBooleanData.TRUE;
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:65,代码来源:SpreadsheetAddInfo.java


示例2: writeMetadata

import org.apache.poi.POIXMLProperties.CoreProperties; //导入依赖的package包/类
private void writeMetadata(XSSFWorkbook workbook) throws IOException, NotFoundException
{
    TestService testService = getTestService();

    CoreProperties workbookCoreProperties = workbook.getProperties().getCoreProperties();

    // Title
    workbookCoreProperties.setTitle(title);

    // Description
    StringBuilder description = new StringBuilder(128);
    DBObject testObj = testService.getTestMetadata(test);
    String testDescription = (String) testObj.get(FIELD_DESCRIPTION);
    if (testDescription != null)
    {
        description.append(testDescription).append("\n");
    }
    DBObject testRunObj = testService.getTestRunMetadata(test, run);
    String testRunDescription = (String) testRunObj.get(FIELD_DESCRIPTION);
    if (testRunDescription != null)
    {
        description.append(testRunDescription);
    }
    workbookCoreProperties.setDescription(description.toString().trim());

    // Created
    Long time = (Long) testRunObj.get(FIELD_STARTED);
    if (time > 0)
    {
        workbookCoreProperties.setCreated(new Nullable<Date>(new Date(time)));
    }
}
 
开发者ID:AlfrescoBenchmark,项目名称:alfresco-benchmark,代码行数:33,代码来源:XLSXReporter.java


示例3: extractMetadata

import org.apache.poi.POIXMLProperties.CoreProperties; //导入依赖的package包/类
private void extractMetadata(CoreProperties properties, Metadata metadata) {
    PackagePropertiesPart propsHolder = properties
            .getUnderlyingProperties();

    addProperty(metadata, OfficeOpenXMLCore.CATEGORY, propsHolder.getCategoryProperty());
    addProperty(metadata, OfficeOpenXMLCore.CONTENT_STATUS, propsHolder
            .getContentStatusProperty());
    addProperty(metadata, TikaCoreProperties.CREATED, propsHolder
            .getCreatedProperty());
    addProperty(metadata, TikaCoreProperties.CREATOR, propsHolder
            .getCreatorProperty());
    addProperty(metadata, TikaCoreProperties.DESCRIPTION, propsHolder
            .getDescriptionProperty());
    addProperty(metadata, TikaCoreProperties.IDENTIFIER, propsHolder
            .getIdentifierProperty());
    addProperty(metadata, TikaCoreProperties.KEYWORDS, propsHolder
            .getKeywordsProperty());
    addProperty(metadata, TikaCoreProperties.LANGUAGE, propsHolder
            .getLanguageProperty());
    addProperty(metadata, TikaCoreProperties.MODIFIER, propsHolder
            .getLastModifiedByProperty());
    addProperty(metadata, TikaCoreProperties.PRINT_DATE, propsHolder
            .getLastPrintedProperty());
    addProperty(metadata, Metadata.LAST_MODIFIED, propsHolder
            .getModifiedProperty());
    addProperty(metadata, TikaCoreProperties.MODIFIED, propsHolder
          .getModifiedProperty());
    addProperty(metadata, OfficeOpenXMLCore.REVISION, propsHolder
            .getRevisionProperty());
    // TODO: Move to OO subject in Tika 2.0
    addProperty(metadata, TikaCoreProperties.TRANSITION_SUBJECT_TO_OO_SUBJECT, 
            propsHolder.getSubjectProperty());
    addProperty(metadata, TikaCoreProperties.TITLE, propsHolder.getTitleProperty());
    addProperty(metadata, OfficeOpenXMLCore.VERSION, propsHolder.getVersionProperty());
    
    // Legacy Tika-1.0 style stats
    // TODO Remove these in Tika 2.0
    addProperty(metadata, Metadata.CATEGORY, propsHolder.getCategoryProperty());
    addProperty(metadata, Metadata.CONTENT_STATUS, propsHolder
            .getContentStatusProperty());
    addProperty(metadata, Metadata.REVISION_NUMBER, propsHolder
            .getRevisionProperty());
    addProperty(metadata, Metadata.VERSION, propsHolder.getVersionProperty());
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:45,代码来源:MetadataExtractor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SQLParserUtils类代码示例发布时间:2022-05-23
下一篇:
Java MavenProperties类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap