Package org.openxmlformats.schemas.officeDocument.x2006.customProperties

Examples of org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty


        addProperty(metadata, Metadata.VERSION, propsHolder.getVersionProperty());
    }

    private void extractMetadata(ExtendedProperties properties,
            Metadata metadata) {
        CTProperties propsHolder = properties.getUnderlyingProperties();

        addProperty(metadata, OfficeOpenXMLExtended.APPLICATION, propsHolder.getApplication());
        addProperty(metadata, OfficeOpenXMLExtended.APP_VERSION, propsHolder.getAppVersion());
        addProperty(metadata, TikaCoreProperties.PUBLISHER, propsHolder.getCompany());
        addProperty(metadata, OfficeOpenXMLExtended.COMPANY, propsHolder.getCompany());
        addProperty(metadata, OfficeOpenXMLExtended.MANAGER, propsHolder.getManager());
        addProperty(metadata, OfficeOpenXMLExtended.NOTES, propsHolder.getNotes());
        addProperty(metadata, OfficeOpenXMLExtended.PRESENTATION_FORMAT, propsHolder.getPresentationFormat());
        addProperty(metadata, OfficeOpenXMLExtended.TEMPLATE, propsHolder.getTemplate());
        addProperty(metadata, OfficeOpenXMLExtended.TOTAL_TIME, propsHolder.getTotalTime());

        if (propsHolder.getPages() > 0) {
           metadata.set(PagedText.N_PAGES, propsHolder.getPages());
        } else if (propsHolder.getSlides() > 0) {
           metadata.set(PagedText.N_PAGES, propsHolder.getSlides());
        }

        // Process the document statistics
        addProperty(metadata, Office.PAGE_COUNT, propsHolder.getPages());
        addProperty(metadata, Office.SLIDE_COUNT, propsHolder.getSlides());
        addProperty(metadata, Office.PARAGRAPH_COUNT, propsHolder.getParagraphs());
        addProperty(metadata, Office.LINE_COUNT, propsHolder.getLines());
        addProperty(metadata, Office.WORD_COUNT, propsHolder.getWords());
        addProperty(metadata, Office.CHARACTER_COUNT, propsHolder.getCharacters());
        addProperty(metadata, Office.CHARACTER_COUNT_WITH_SPACES, propsHolder.getCharactersWithSpaces());
       
        // Legacy Tika-1.0 style stats
        // TODO Remove these in Tika 2.0
        addProperty(metadata, Metadata.APPLICATION_NAME, propsHolder.getApplication());
        addProperty(metadata, Metadata.APPLICATION_VERSION, propsHolder.getAppVersion());
        addProperty(metadata, Metadata.MANAGER, propsHolder.getManager());
        addProperty(metadata, Metadata.NOTES, propsHolder.getNotes());
        addProperty(metadata, Metadata.PRESENTATION_FORMAT, propsHolder.getPresentationFormat());
        addProperty(metadata, Metadata.TEMPLATE, propsHolder.getTemplate());
        addProperty(metadata, Metadata.TOTAL_TIME, propsHolder.getTotalTime());
        addProperty(metadata, MSOffice.PAGE_COUNT, propsHolder.getPages());
        addProperty(metadata, MSOffice.SLIDE_COUNT, propsHolder.getSlides());
        addProperty(metadata, MSOffice.PARAGRAPH_COUNT, propsHolder.getParagraphs());
        addProperty(metadata, MSOffice.LINE_COUNT, propsHolder.getLines());
        addProperty(metadata, MSOffice.WORD_COUNT, propsHolder.getWords());
        addProperty(metadata, MSOffice.CHARACTER_COUNT, propsHolder.getCharacters());
        addProperty(metadata, MSOffice.CHARACTER_COUNT_WITH_SPACES, propsHolder.getCharactersWithSpaces());
    }
View Full Code Here


        addProperty(metadata, Metadata.VERSION, propsHolder.getVersionProperty());
    }

    private void extractMetadata(ExtendedProperties properties,
            Metadata metadata) {
        CTProperties propsHolder = properties.getUnderlyingProperties();

        addProperty(metadata, Metadata.APPLICATION_NAME, propsHolder
                .getApplication());
        addProperty(metadata, Metadata.APPLICATION_VERSION, propsHolder
                .getAppVersion());
        addProperty(metadata, Metadata.CHARACTER_COUNT, propsHolder
                .getCharacters());
        addProperty(metadata, Metadata.CHARACTER_COUNT_WITH_SPACES, propsHolder
                .getCharactersWithSpaces());
        addProperty(metadata, Metadata.PUBLISHER, propsHolder.getCompany());
        addProperty(metadata, Metadata.LINE_COUNT, propsHolder.getLines());
        addProperty(metadata, Metadata.MANAGER, propsHolder.getManager());
        addProperty(metadata, Metadata.NOTES, propsHolder.getNotes());
        addProperty(metadata, Metadata.PAGE_COUNT, propsHolder.getPages());
        if (propsHolder.getPages() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getPages());
        } else if (propsHolder.getSlides() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getSlides());
        }
        addProperty(metadata, Metadata.PARAGRAPH_COUNT, propsHolder.getParagraphs());
        addProperty(metadata, Metadata.PRESENTATION_FORMAT, propsHolder
                .getPresentationFormat());
        addProperty(metadata, Metadata.SLIDE_COUNT, propsHolder.getSlides());
        addProperty(metadata, Metadata.TEMPLATE, propsHolder.getTemplate());
        addProperty(metadata, Metadata.TOTAL_TIME, propsHolder.getTotalTime());
        addProperty(metadata, Metadata.WORD_COUNT, propsHolder.getWords());
    }
View Full Code Here

  //rename sheet in app.xml(extended properties)
  private void ranameSheetInAppXml(String oldsheetname, String name) {
      POIXMLProperties properties = getProperties(); //app.xml and custom.xml

    CTProperties ext = properties.getExtendedProperties().getUnderlyingProperties();
    CTVectorVariant vectorv = ext.getHeadingPairs();
    CTVector vector = vectorv.getVector();
    CTVariant[] variants = vector.getVariantArray();
    int sheetCount = -1;
    int nameCount = -1;
    for(int j = 0; j < variants.length; ++j) {
      final CTVariant variant = variants[j];
      if ((j & 1) == 0) { //string
        String key = variant.getLpstr();
        if ("Worksheets".equalsIgnoreCase(key)) {
          final CTVariant variant2 = variants[++j];
          sheetCount = variant2.getI4();
        } else if ("Named Ranges".equalsIgnoreCase(key)) {
          final CTVariant variant2 = variants[++j];
          nameCount = variant2.getI4();
        }
      }
    }
    if (sheetCount >= 0 && nameCount >= 0) {
      nameCount += sheetCount;
    }
    CTVectorLpstr vectorv2 = ext.getTitlesOfParts();
    CTVector vector2 = vectorv2.getVector();
    String[] lpstrs = vector2.getLpstrArray();
    int j = 0;
    for(; j < sheetCount; ++j) {
      final String sname = lpstrs[j];
View Full Code Here

        addProperty(metadata, Metadata.VERSION, propsHolder.getVersionProperty());
    }

    private void extractMetadata(ExtendedProperties properties,
            Metadata metadata) {
        CTProperties propsHolder = properties.getUnderlyingProperties();

        addProperty(metadata, Metadata.APPLICATION_NAME, propsHolder
                .getApplication());
        addProperty(metadata, Metadata.APPLICATION_VERSION, propsHolder
                .getAppVersion());
        addProperty(metadata, Metadata.CHARACTER_COUNT, propsHolder
                .getCharacters());
        addProperty(metadata, Metadata.CHARACTER_COUNT_WITH_SPACES, propsHolder
                .getCharactersWithSpaces());
        addProperty(metadata, Metadata.PUBLISHER, propsHolder.getCompany());
        addProperty(metadata, Metadata.LINE_COUNT, propsHolder.getLines());
        addProperty(metadata, Metadata.MANAGER, propsHolder.getManager());
        addProperty(metadata, Metadata.NOTES, propsHolder.getNotes());
        addProperty(metadata, Metadata.PAGE_COUNT, propsHolder.getPages());
        if (propsHolder.getPages() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getPages());
        } else if (propsHolder.getSlides() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getSlides());
        }
        addProperty(metadata, Metadata.PARAGRAPH_COUNT, propsHolder.getParagraphs());
        addProperty(metadata, Metadata.PRESENTATION_FORMAT, propsHolder
                .getPresentationFormat());
        addProperty(metadata, Metadata.SLIDE_COUNT, propsHolder.getSlides());
        addProperty(metadata, Metadata.TEMPLATE, propsHolder.getTemplate());
        addProperty(metadata, Metadata.TOTAL_TIME, propsHolder.getTotalTime());
        addProperty(metadata, Metadata.WORD_COUNT, propsHolder.getWords());
    }
View Full Code Here

        addProperty(metadata, Metadata.VERSION, propsHolder.getVersionProperty());
    }

    private void extractMetadata(ExtendedProperties properties,
            Metadata metadata) {
        CTProperties propsHolder = properties.getUnderlyingProperties();

        addProperty(metadata, Metadata.APPLICATION_NAME, propsHolder
                .getApplication());
        addProperty(metadata, Metadata.APPLICATION_VERSION, propsHolder
                .getAppVersion());
        addProperty(metadata, Metadata.CHARACTER_COUNT, propsHolder
                .getCharacters());
        addProperty(metadata, Metadata.CHARACTER_COUNT_WITH_SPACES, propsHolder
                .getCharactersWithSpaces());
        addProperty(metadata, Metadata.PUBLISHER, propsHolder.getCompany());
        addProperty(metadata, Metadata.LINE_COUNT, propsHolder.getLines());
        addProperty(metadata, Metadata.MANAGER, propsHolder.getManager());
        addProperty(metadata, Metadata.NOTES, propsHolder.getNotes());
        addProperty(metadata, Metadata.PAGE_COUNT, propsHolder.getPages());
        addProperty(metadata, Metadata.PARAGRAPH_COUNT, propsHolder.getParagraphs());
        addProperty(metadata, Metadata.PRESENTATION_FORMAT, propsHolder
                .getPresentationFormat());
        addProperty(metadata, Metadata.SLIDE_COUNT, propsHolder.getSlides());
        addProperty(metadata, Metadata.TEMPLATE, propsHolder.getTemplate());
        addProperty(metadata, Metadata.TOTAL_TIME, propsHolder.getTotalTime());
        addProperty(metadata, Metadata.WORD_COUNT, propsHolder.getWords());
    }
View Full Code Here

*
*/
public final class TestAllExtendedProperties extends TestCase {
  public void testGetAllExtendedProperties() throws IOException {
    XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("TestPoiXMLDocumentCorePropertiesGetKeywords.docx");
    CTProperties ctProps = doc.getProperties().getExtendedProperties().getUnderlyingProperties();
    assertEquals("Microsoft Office Word",ctProps.getApplication());
    assertEquals("14.0000",ctProps.getAppVersion());
    assertEquals(57,ctProps.getCharacters());
    assertEquals(66,ctProps.getCharactersWithSpaces());
    assertEquals("",ctProps.getCompany());
    assertNull(ctProps.getDigSig());
    assertEquals(0,ctProps.getDocSecurity());
    assertNotNull(ctProps.getDomNode());
   
    CTVectorVariant vec = ctProps.getHeadingPairs();
    assertEquals(2,vec.getVector().sizeOfVariantArray());
    assertEquals("Title",vec.getVector().getVariantArray(0).getLpstr());
    assertEquals(1,vec.getVector().getVariantArray(1).getI4());
   
    assertFalse(ctProps.isSetHiddenSlides());
    assertEquals(0,ctProps.getHiddenSlides());
    assertFalse(ctProps.isSetHLinks());
    assertNull(ctProps.getHLinks());
    assertNull(ctProps.getHyperlinkBase());
    assertTrue(ctProps.isSetHyperlinksChanged());
    assertFalse(ctProps.getHyperlinksChanged());
    assertEquals(1,ctProps.getLines());
    assertTrue(ctProps.isSetLinksUpToDate());
    assertFalse(ctProps.getLinksUpToDate());
    assertNull(ctProps.getManager());
    assertFalse(ctProps.isSetMMClips());
    assertEquals(0,ctProps.getMMClips());
    assertFalse(ctProps.isSetNotes());
    assertEquals(0,ctProps.getNotes());
    assertEquals(1,ctProps.getPages());
    assertEquals(1,ctProps.getParagraphs());
    assertNull(ctProps.getPresentationFormat());
    assertTrue(ctProps.isSetScaleCrop());
    assertFalse(ctProps.getScaleCrop());
    assertTrue(ctProps.isSetSharedDoc());
    assertFalse(ctProps.getSharedDoc());
    assertFalse(ctProps.isSetSlides());
    assertEquals(0,ctProps.getSlides());
    assertEquals("Normal.dotm",ctProps.getTemplate());
   
    CTVectorLpstr vec2 = ctProps.getTitlesOfParts();
    assertEquals(1,vec2.getVector().sizeOfLpstrArray());
    assertEquals("Example Word 2010 Document",vec2.getVector().getLpstrArray(0));
   
    assertEquals(3,ctProps.getTotalTime());
    assertEquals(10,ctProps.getWords());
   
    // Check the digital signature part
    // Won't be there in this file, but we
    //  need to do this check so that the
    //  appropriate parts end up in the
    //  smaller ooxml schemas file
    CTDigSigBlob blob = ctProps.getDigSig();
    assertNull(blob);
   
    blob = CTDigSigBlob.Factory.newInstance();
    blob.setBlob(new byte [] {2,6,7,2,3,4,5,1,2,3});
  }
View Full Code Here

*
*/
public final class TestAllExtendedProperties extends TestCase {
  public void testGetAllExtendedProperties() {
    XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("TestPoiXMLDocumentCorePropertiesGetKeywords.docx");
    CTProperties ctProps = doc.getProperties().getExtendedProperties().getUnderlyingProperties();
    assertEquals("Microsoft Office Word",ctProps.getApplication());
    assertEquals("14.0000",ctProps.getAppVersion());
    assertEquals(57,ctProps.getCharacters());
    assertEquals(66,ctProps.getCharactersWithSpaces());
    assertEquals("",ctProps.getCompany());
    assertNull(ctProps.getDigSig());
    assertEquals(0,ctProps.getDocSecurity());
    assertNotNull(ctProps.getDomNode());
   
    CTVectorVariant vec = ctProps.getHeadingPairs();
    assertEquals(2,vec.getVector().sizeOfVariantArray());
    assertEquals("Title",vec.getVector().getVariantArray(0).getLpstr());
    assertEquals(1,vec.getVector().getVariantArray(1).getI4());
   
    assertFalse(ctProps.isSetHiddenSlides());
    assertEquals(0,ctProps.getHiddenSlides());
    assertFalse(ctProps.isSetHLinks());
    assertNull(ctProps.getHLinks());
    assertNull(ctProps.getHyperlinkBase());
    assertTrue(ctProps.isSetHyperlinksChanged());
    assertFalse(ctProps.getHyperlinksChanged());
    assertEquals(1,ctProps.getLines());
    assertTrue(ctProps.isSetLinksUpToDate());
    assertFalse(ctProps.getLinksUpToDate());
    assertNull(ctProps.getManager());
    assertFalse(ctProps.isSetMMClips());
    assertEquals(0,ctProps.getMMClips());
    assertFalse(ctProps.isSetNotes());
    assertEquals(0,ctProps.getNotes());
    assertEquals(1,ctProps.getPages());
    assertEquals(1,ctProps.getParagraphs());
    assertNull(ctProps.getPresentationFormat());
    assertTrue(ctProps.isSetScaleCrop());
    assertFalse(ctProps.getScaleCrop());
    assertTrue(ctProps.isSetSharedDoc());
    assertFalse(ctProps.getSharedDoc());
    assertFalse(ctProps.isSetSlides());
    assertEquals(0,ctProps.getSlides());
    assertEquals("Normal.dotm",ctProps.getTemplate());
   
    CTVectorLpstr vec2 = ctProps.getTitlesOfParts();
    assertEquals(1,vec2.getVector().sizeOfLpstrArray());
    assertEquals("Example Word 2010 Document",vec2.getVector().getLpstrArray(0));
   
    assertEquals(3,ctProps.getTotalTime());
    assertEquals(10,ctProps.getWords());
   
    // Check the digital signature part
    // Won't be there in this file, but we
    //  need to do this check so that the
    //  appropriate parts end up in the
    //  smaller ooxml schemas file
    CTDigSigBlob blob = ctProps.getDigSig();
    assertNull(blob);
   
    blob = CTDigSigBlob.Factory.newInstance();
    blob.setBlob(new byte [] {2,6,7,2,3,4,5,1,2,3});
  }
View Full Code Here

        addProperty(metadata, Metadata.VERSION, propsHolder.getVersionProperty());
    }

    private void extractMetadata(ExtendedProperties properties,
            Metadata metadata) {
        CTProperties propsHolder = properties.getUnderlyingProperties();

        addProperty(metadata, Metadata.APPLICATION_NAME, propsHolder
                .getApplication());
        addProperty(metadata, Metadata.APPLICATION_VERSION, propsHolder
                .getAppVersion());
        addProperty(metadata, Metadata.CHARACTER_COUNT, propsHolder
                .getCharacters());
        addProperty(metadata, Metadata.CHARACTER_COUNT_WITH_SPACES, propsHolder
                .getCharactersWithSpaces());
        addProperty(metadata, Metadata.PUBLISHER, propsHolder.getCompany());
        addProperty(metadata, Metadata.LINE_COUNT, propsHolder.getLines());
        addProperty(metadata, Metadata.MANAGER, propsHolder.getManager());
        addProperty(metadata, Metadata.NOTES, propsHolder.getNotes());
        addProperty(metadata, Metadata.PAGE_COUNT, propsHolder.getPages());
        if (propsHolder.getPages() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getPages());
        } else if (propsHolder.getSlides() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getSlides());
        }
        addProperty(metadata, Metadata.PARAGRAPH_COUNT, propsHolder.getParagraphs());
        addProperty(metadata, Metadata.PRESENTATION_FORMAT, propsHolder
                .getPresentationFormat());
        addProperty(metadata, Metadata.SLIDE_COUNT, propsHolder.getSlides());
        addProperty(metadata, Metadata.TEMPLATE, propsHolder.getTemplate());
        addProperty(metadata, Metadata.TOTAL_TIME, propsHolder.getTotalTime());
        addProperty(metadata, Metadata.WORD_COUNT, propsHolder.getWords());
    }
View Full Code Here

        addProperty(metadata, Metadata.VERSION, propsHolder.getVersionProperty());
    }

    private void extractMetadata(ExtendedProperties properties,
            Metadata metadata) {
        CTProperties propsHolder = properties.getUnderlyingProperties();

        addProperty(metadata, Metadata.APPLICATION_NAME, propsHolder
                .getApplication());
        addProperty(metadata, Metadata.APPLICATION_VERSION, propsHolder
                .getAppVersion());
        addProperty(metadata, Metadata.CHARACTER_COUNT, propsHolder
                .getCharacters());
        addProperty(metadata, Metadata.CHARACTER_COUNT_WITH_SPACES, propsHolder
                .getCharactersWithSpaces());
        addProperty(metadata, Metadata.PUBLISHER, propsHolder.getCompany());
        addProperty(metadata, Metadata.LINE_COUNT, propsHolder.getLines());
        addProperty(metadata, Metadata.MANAGER, propsHolder.getManager());
        addProperty(metadata, Metadata.NOTES, propsHolder.getNotes());
        addProperty(metadata, Metadata.PAGE_COUNT, propsHolder.getPages());
        if (propsHolder.getPages() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getPages());
        } else if (propsHolder.getSlides() > 0) {
            metadata.set(PagedText.N_PAGES, propsHolder.getSlides());
        }
        addProperty(metadata, Metadata.PARAGRAPH_COUNT, propsHolder.getParagraphs());
        addProperty(metadata, Metadata.PRESENTATION_FORMAT, propsHolder
                .getPresentationFormat());
        addProperty(metadata, Metadata.SLIDE_COUNT, propsHolder.getSlides());
        addProperty(metadata, Metadata.TEMPLATE, propsHolder.getTemplate());
        addProperty(metadata, Metadata.TOTAL_TIME, propsHolder.getTotalTime());
        addProperty(metadata, Metadata.WORD_COUNT, propsHolder.getWords());
    }
View Full Code Here

      }
    }
    if (sheetCount >= 0 && nameCount >= 0) {
      nameCount += sheetCount;
    }
    CTVectorLpstr vectorv2 = ext.getTitlesOfParts();
    CTVector vector2 = vectorv2.getVector();
    String[] lpstrs = vector2.getLpstrArray();
    int j = 0;
    for(; j < sheetCount; ++j) {
      final String sname = lpstrs[j];
      if (oldsheetname.equals(sname)) {
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty

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.