Package org.openxmlformats.schemas.officeDocument.x2006.extendedProperties

Examples of org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTVectorLpstr


      if(contains(name)) {
        throw new IllegalArgumentException("A property with this name " +
            "already exists in the custom properties");
      }

      CTProperty p = props.getProperties().addNewProperty();
      int pid = nextPid();
      p.setPid(pid);
      p.setFmtid(FORMAT_ID);
      p.setName(name);
      return p;
    }
View Full Code Here


     * Add a new string property
     *
     * @throws IllegalArgumentException if a property with this name already exists
     */
     public void addProperty(String name, String value){
      CTProperty p = add(name);
      p.setLpwstr(value);
    }
View Full Code Here

     * Add a new double property
     *
     * @throws IllegalArgumentException if a property with this name already exists
     */
    public void addProperty(String name, double value){
      CTProperty p = add(name);
      p.setR8(value);
    }
View Full Code Here

     * Add a new integer property
     *
     * @throws IllegalArgumentException if a property with this name already exists
     */
    public void addProperty(String name, int value){
      CTProperty p = add(name);
      p.setI4(value);
    }
View Full Code Here

     * Add a new boolean property
     *
     * @throws IllegalArgumentException if a property with this name already exists
     */
    public void addProperty(String name, boolean value){
      CTProperty p = add(name);
      p.setBool(value);
    }
View Full Code Here

    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;
View Full Code Here

  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];
      if (oldsheetname.equals(sname)) {
        vector2.setLpstrArray(j, name);
        j = sheetCount;
        break;
      }
    }
    final String o = SheetNameFormatter.format(oldsheetname);
    final String n = SheetNameFormatter.format(name);
    for(; j < nameCount; ++j) {
      final String refname = lpstrs[j];
      final String newrefname = refname.replace(o+"!", n+"!");
      if (!newrefname.equals(refname)) {
        vector2.setLpstrArray(j, newrefname);
      }
    }
  }
View Full Code Here

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

    // 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());
        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

TOP

Related Classes of org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.CTVectorLpstr

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.