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

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

Introduction

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

Prototype

public void setCreateDateTime(final Date createDateTime) 

Source Link

Document

Sets the creation time.

Usage

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 w w  .  ja  va2  s.  c  o  m
    }
    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();
    }
}

From source file:se.mithlond.services.content.impl.ejb.report.ExcelReportServiceBean.java

License:Apache License

/**
 * {@inheritDoc}/*from w  w  w  .j  ava 2s .c o  m*/
 */
@Override
public Workbook createDocument(@NotNull final Membership activeMembership, @NotNull final String title) {

    // Check sanity
    Validate.notNull(activeMembership, "activeMembership");

    final HSSFWorkbook toReturn = new HSSFWorkbook();
    toReturn.createInformationProperties();

    // Add some comments.
    final SummaryInformation summaryInformation = toReturn.getSummaryInformation();
    summaryInformation.setCreateDateTime(new Date());
    summaryInformation.setTitle(title);
    summaryInformation.setAuthor("Nazgl Services Excel Report Generator");
    summaryInformation.setSubject("Requested by: " + activeMembership.getAlias());
    summaryInformation.setRevNumber("1");

    // Add some Document summary information as well.
    final DocumentSummaryInformation documentSummaryInformation = toReturn.getDocumentSummaryInformation();
    final String orgName = activeMembership.getOrganisation().getOrganisationName();
    documentSummaryInformation.setCompany(activeMembership.getOrganisation().getOrganisationName());
    documentSummaryInformation.setManager(orgName + " is Da Boss of you!");

    // All Done.
    return toReturn;
}