Search in sources :

Example 1 with CoreProperties

use of org.apache.poi.POIXMLProperties.CoreProperties in project poi by apache.

the class TestPOIXMLProperties method testTransitiveSetters.

@Test
public void testTransitiveSetters() throws IOException {
    XWPFDocument doc = new XWPFDocument();
    CoreProperties cp = doc.getProperties().getCoreProperties();
    Date dateCreated = LocaleUtil.getLocaleCalendar(2010, 6, 15, 10, 0, 0).getTime();
    cp.setCreated(new Nullable<Date>(dateCreated));
    assertEquals(dateCreated, cp.getCreated());
    XWPFDocument doc2 = XWPFTestDataSamples.writeOutAndReadBack(doc);
    doc.close();
    cp = doc2.getProperties().getCoreProperties();
    Date dt3 = cp.getCreated();
    assertEquals(dateCreated, dt3);
    doc2.close();
}
Also used : CoreProperties(org.apache.poi.POIXMLProperties.CoreProperties) XWPFDocument(org.apache.poi.xwpf.usermodel.XWPFDocument) Date(java.util.Date) Test(org.junit.Test)

Example 2 with CoreProperties

use of org.apache.poi.POIXMLProperties.CoreProperties in project poi by apache.

the class TestXSLFSlideShow method testMetadataBasics.

@Test
public void testMetadataBasics() throws IOException, OpenXML4JException, XmlException {
    XSLFSlideShow xml = new XSLFSlideShow(pack);
    assertNotNull(xml.getProperties().getCoreProperties());
    assertNotNull(xml.getProperties().getExtendedProperties());
    CTProperties props = xml.getProperties().getExtendedProperties().getUnderlyingProperties();
    assertEquals("Microsoft Office PowerPoint", props.getApplication());
    assertEquals(0, props.getCharacters());
    assertEquals(0, props.getLines());
    CoreProperties cprops = xml.getProperties().getCoreProperties();
    assertNull(cprops.getTitle());
    assertNull(cprops.getUnderlyingProperties().getSubjectProperty().getValue());
    xml.close();
}
Also used : CoreProperties(org.apache.poi.POIXMLProperties.CoreProperties) XSLFSlideShow(org.apache.poi.xslf.usermodel.XSLFSlideShow) CTProperties(org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties) Test(org.junit.Test)

Aggregations

CoreProperties (org.apache.poi.POIXMLProperties.CoreProperties)2 Test (org.junit.Test)2 Date (java.util.Date)1 XSLFSlideShow (org.apache.poi.xslf.usermodel.XSLFSlideShow)1 XWPFDocument (org.apache.poi.xwpf.usermodel.XWPFDocument)1 CTProperties (org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTProperties)1