Package org.apache.poi

Examples of org.apache.poi.POIXMLProperties


  /**
   *  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


        }
        else if(xmlFormat==FORMAT_XSSF)  {
          infostruct.put("SPREADSHEETTYPE", "Excel (2007)");
           
          XSSFWorkbook xssfworkbook = (XSSFWorkbook)workbook;
            POIXMLProperties props = xssfworkbook.getProperties();
            info(infostruct,props.getCoreProperties().getUnderlyingProperties());
            info(infostruct,props.getExtendedProperties().getUnderlyingProperties());
        }
        return infostruct;
    }
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 XSSFEventBasedExcelExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
    super(null);
    this.container = container;
   
    properties = new POIXMLProperties(container);
  }
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 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.
         */
       
        POIXMLProperties.CustomProperties cust =  props.getCustomProperties();
        cust.addProperty("Author", "John Smith");
        cust.addProperty("Year", 2009);
        cust.addProperty("Price", 45.50);
        cust.addProperty("Available", true);

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 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
   */
    @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

    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.