Example usage for org.apache.poi.hpsf SummaryInformation setApplicationName

List of usage examples for org.apache.poi.hpsf SummaryInformation setApplicationName

Introduction

In this page you can find the example usage for org.apache.poi.hpsf SummaryInformation setApplicationName.

Prototype

public void setApplicationName(final String applicationName) 

Source Link

Document

Sets the application name.

Usage

From source file:edu.casetools.rcase.extensions.excel.control.Exporter.java

License:Open Source License

private void setDefaultProperties(String templateName) {
    HSSFWorkbook hworkbook = (HSSFWorkbook) this.workbook;
    hworkbook.createInformationProperties();
    SummaryInformation si = hworkbook.getSummaryInformation();
    DocumentSummaryInformation dsi = hworkbook.getDocumentSummaryInformation();
    si.setAuthor(I18nMessageService.getString("Excel.Author"));

    dsi.setCompany(I18nMessageService.getString("Excel.Company"));
    si.setApplicationName(I18nMessageService.getString("Excel.Application"));
    org.apache.poi.hpsf.CustomProperties cp = dsi.getCustomProperties();

    cp.put("Table Template", templateName);
    dsi.setCustomProperties(cp);// ww  w .  j  ava2s  . c  om
}

From source file:ro.nextreports.engine.exporter.XlsExporter.java

License:Apache License

public static void createSummaryInformation(String filePath, String title) {

    if (filePath == null) {
        return;/*w ww  .  ja v  a 2  s  .  c  om*/
    }
    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();
    }
}