Package org.apache.poi

Examples of org.apache.poi.POIXMLProperties


   *  Test setting of core properties such as Title and Author
   */
    @Test
  public void workbookProperties() {
    XSSFWorkbook workbook = new XSSFWorkbook();
    POIXMLProperties props = workbook.getProperties();
    assertNotNull(props);
    //the Application property must be set for new workbooks, see Bugzilla #47559
    assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());

    PackagePropertiesPart opcProps = props.getCoreProperties().getUnderlyingProperties();
    assertNotNull(opcProps);

    opcProps.setTitleProperty("Testing Bugzilla #47460");
    assertEquals("Apache POI", opcProps.getCreatorProperty().getValue());
    opcProps.setCreatorProperty("poi-dev@poi.apache.org");
View Full Code Here


  /**
   *  Test setting of core properties such as Title and Author
   */
  public void testWorkbookProperties() {
    XSSFWorkbook workbook = new XSSFWorkbook();
    POIXMLProperties props = workbook.getProperties();
    assertNotNull(props);
    //the Application property must be set for new workbooks, see Bugzilla #47559
    assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());

    PackagePropertiesPart opcProps = props.getCoreProperties().getUnderlyingProperties();
    assertNotNull(opcProps);

    opcProps.setTitleProperty("Testing Bugzilla #47460");
    assertEquals("Apache POI", opcProps.getCreatorProperty().getValue());
    opcProps.setCreatorProperty("poi-dev@poi.apache.org");
View Full Code Here

    }
    public XSSFEventBasedExcelExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
        super(null);
        this.container = container;

        properties = new POIXMLProperties(container);
    }
View Full Code Here

    public void bug54764() throws Exception {
        OPCPackage pkg = XSSFTestDataSamples.openSamplePackage("54764.xlsx");
       
        // Check the core properties - will be found but empty, due
        //  to the expansion being too much to be considered valid
        POIXMLProperties props = new POIXMLProperties(pkg);
        assertEquals(null, props.getCoreProperties().getTitle());
        assertEquals(null, props.getCoreProperties().getSubject());
        assertEquals(null, props.getCoreProperties().getDescription());
       
        // Now check the spreadsheet itself
        try {
            new XSSFWorkbook(pkg);
            fail("Should fail as too much expansion occurs");
View Full Code Here

  /**
   *  Test setting of core properties such as Title and Author
   */
  public void testWorkbookProperties() {
    XSSFWorkbook workbook = new XSSFWorkbook();
    POIXMLProperties props = workbook.getProperties();
    assertNotNull(props);
    //the Application property must be set for new workbooks, see Bugzilla #47559
    assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());

    PackagePropertiesPart opcProps = props.getCoreProperties().getUnderlyingProperties();
    assertNotNull(opcProps);

    opcProps.setTitleProperty("Testing Bugzilla #47460");
    assertEquals("Apache POI", opcProps.getCreatorProperty().getValue());
    opcProps.setCreatorProperty("poi-dev@poi.apache.org");
View Full Code Here

    assertEquals(" ", xml.getProperties().getCoreProperties().getUnderlyingProperties().getSubjectProperty().getValue());
  }

  public void testWorkbookProperties() {
    XWPFDocument doc = new XWPFDocument();
    POIXMLProperties props = doc.getProperties();
    assertNotNull(props);
    assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());
  }
View Full Code Here

    public static void main(String[]args) throws Exception {

        XSSFWorkbook workbook = new XSSFWorkbook();
        workbook.createSheet("Workbook Properties");

        POIXMLProperties props = workbook.getProperties();

        /**
         * Extended properties are a predefined set of metadata properties
         * that are specifically applicable to Office Open XML documents.
         * Extended properties consist of 24 simple properties and 3 complex properties stored in the
         *  part targeted by the relationship of type
         */
        POIXMLProperties.ExtendedProperties ext =  props.getExtendedProperties();
        ext.getUnderlyingProperties().setCompany("Apache Software Foundation");
        ext.getUnderlyingProperties().setTemplate("XSSF");

        /**
         * Custom properties enable users to define custom metadata properties
         * through a set of well-defined data types. For example, a custom
         * OLE Editor property of type string can be defined as follows:
         *
         *  <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="Editor">
         *    <vt:lpwstr>John Smith</vt:lpwstr>
         </property>
         */
       
        POIXMLProperties.CustomProperties cust =  props.getCustomProperties();
        org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty
                property = cust.getUnderlyingProperties().addNewProperty();

        property.setFmtid("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}");
        property.setPid(2);
View Full Code Here

  /**
   *  Test setting of core properties such as Title and Author
   */
  public void testWorkbookProperties() {
    XSSFWorkbook workbook = new XSSFWorkbook();
    POIXMLProperties props = workbook.getProperties();
    assertNotNull(props);
    //the Application property must be set for new workbooks, see Bugzilla #47559
    assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());

    PackagePropertiesPart opcProps = props.getCoreProperties().getUnderlyingProperties();
    assertNotNull(opcProps);

    opcProps.setTitleProperty("Testing Bugzilla #47460");
    assertEquals("Apache POI", opcProps.getCreatorProperty().getValue());
    opcProps.setCreatorProperty("poi-dev@poi.apache.org");
View Full Code Here

  }
  public XSSFEventBasedExcelExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
    super(null);
    this.container = container;
   
    properties = new POIXMLProperties(container);
  }
View Full Code Here

    assertEquals(" ", xml.getProperties().getCoreProperties().getUnderlyingProperties().getSubjectProperty().getValue());
  }

  public void testWorkbookProperties() {
    XWPFDocument doc = new XWPFDocument();
    POIXMLProperties props = doc.getProperties();
    assertNotNull(props);
    assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.POIXMLProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.