>> Ok, for an Office 2007 file, I can identify what is different, but 
using 
>> POI how do I set a custom property on a file.
>Which bit of the file is different? If you can tell us which xml part of 
>the .xlsx file differs, we can point you at the code to work with it :)

custom.xml exists when there is a property, and does not exist when there 
is not a property.

In a XLSX file where the property "TestProp" lins to a cell labeled "Test" 
the following line exists:
    <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" 
name="TestProp" linkTarget="Test">
      <vt:r8>1.23</vt:r8> 
    </property>

In a XLSX file where the property "TestProp" just has a value (not linked) 
the following line exists:
    <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" 
name="TestProp">
      <vt:r8>1.23</vt:r8> 
    </property>

I know how to retrieve the property:
        double propValue = 0.0;

 
org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties
            props = 
textEx.getDocument().getProperties().getCustomProperties().getUnderlyingProperties();
        CTProperty[] properties = props.getPropertyArray();
        for (int i = 0; i < properties.length; i++)
        {
            if (properties[i].getName().equals(key))
            {
                if (properties[i].isSetR8())
                {
                    rpropValue = properties[i].getR8();
                }
                break;
            }
        }

but how do I check the "linkTarget" and how do I change the "<vt:r8>"?

Reply via email to