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


Java SummaryInformation.setSubject方法代码示例

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


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

示例1: execute

import org.apache.poi.hpsf.SummaryInformation; //导入方法依赖的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: createSummaryInformation

import org.apache.poi.hpsf.SummaryInformation; //导入方法依赖的package包/类
public static void createSummaryInformation(String filePath, String title) {

        if (filePath == null) {
            return;
        }
        try {
            File poiFilesystem = new File(filePath);
            InputStream is = new FileInputStream(poiFilesystem);
            POIFSFileSystem poifs = new POIFSFileSystem(is);
            is.close();
            DirectoryEntry dir = poifs.getRoot();

            SummaryInformation si = PropertySetFactory.newSummaryInformation();
            si.setTitle(title);
            si.setAuthor(ReleaseInfoAdapter.getCompany());
            si.setApplicationName("NextReports " + ReleaseInfoAdapter.getVersionNumber());
            si.setSubject("Created by NextReports Designer" + ReleaseInfoAdapter.getVersionNumber());
            si.setCreateDateTime(new Date());
            si.setKeywords(ReleaseInfoAdapter.getHome());

            si.write(dir, SummaryInformation.DEFAULT_STREAM_NAME);

            OutputStream out = new FileOutputStream(poiFilesystem);
            poifs.writeFilesystem(out);
            out.close();
        }
        catch (Exception ex) {
            ex.printStackTrace();
        }
    }
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:31,代码来源:XlsExporter.java

示例3: prepareHSSFMetaData

import org.apache.poi.hpsf.SummaryInformation; //导入方法依赖的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.hpsf.SummaryInformation.setSubject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。