public class CustomPart
extends java.lang.Object
implements java.lang.Cloneable
To learn more, visit the Structured Document Tags or Content Control documentation article.
This class represents an OOXML part that is a target of an "unknown relationship". All relationships not defined within ISO/IEC 29500 are considered "unknown relationships". Unknown relationships are permitted within an Office Open XML document provided that they conform to relationship markup guidelines.
Microsoft Word preserves custom parts during open/save cycles. Some additional info can be found here http://blogs.msdn.com/dmahugh/archive/2006/11/25/arbitrary-content-in-an-opc-package.aspx
Aspose.Words also roundtrips custom parts and in addition, allows to programmatically access such parts via the CustomPart and CustomPartCollection objects.
Do not confuse custom parts with Custom XML Data. Use CustomXmlPart if you need to access Custom XML Data.
| Modifier and Type | Method and Description |
|---|---|
CustomPart |
deepClone()
Makes a "deep enough" copy of the object.
|
java.lang.String |
getContentType()
Specifies the content type of this custom part.
|
byte[] |
getData()
Contains the data of this custom part.
|
java.lang.String |
getName()
Gets this part's absolute name within the OOXML package or the target URL.
|
java.lang.String |
getRelationshipType()
Gets the relationship type from the parent part to this custom part.
|
boolean |
isExternal()
False if this custom part is stored inside the OOXML package. |
void |
isExternal(boolean value)
False if this custom part is stored inside the OOXML package. |
protected java.lang.Object |
memberwiseClone() |
void |
setContentType(java.lang.String value)
Specifies the content type of this custom part.
|
void |
setData(byte[] value)
Contains the data of this custom part.
|
void |
setName(java.lang.String value)
Sets this part's absolute name within the OOXML package or the target URL.
|
void |
setRelationshipType(java.lang.String value)
Sets the relationship type from the parent part to this custom part.
|
public java.lang.String getName()
If the relationship target is internal, then this property is the absolute part name within the package. If the relationship target is external, then this property is the target URL.
The default value is an empty string. A valid value must be a non-empty string.
isExternal(),
isExternal(boolean)public void setName(java.lang.String value)
If the relationship target is internal, then this property is the absolute part name within the package. If the relationship target is external, then this property is the target URL.
The default value is an empty string. A valid value must be a non-empty string.
value - This part's absolute name within the OOXML package or the target URL.isExternal(),
isExternal(boolean)public java.lang.String getRelationshipType()
The relationship type for a custom part must be "unknown" e.g. a custom relationship type, not one of the relationship types defined within ISO/IEC 29500.
The default value is an empty string. A valid value must be a non-empty string.
public void setRelationshipType(java.lang.String value)
The relationship type for a custom part must be "unknown" e.g. a custom relationship type, not one of the relationship types defined within ISO/IEC 29500.
The default value is an empty string. A valid value must be a non-empty string.
value - The relationship type from the parent part to this custom part.public boolean isExternal()
False if this custom part is stored inside the OOXML package. True if this custom part is an external target.
The default value is false.
boolean value.getName(),
setName(java.lang.String)public void isExternal(boolean value)
False if this custom part is stored inside the OOXML package. True if this custom part is an external target.
The default value is false.
value - The corresponding boolean value.getName(),
setName(java.lang.String)public java.lang.String getContentType()
This property is applicable only when isExternal() / isExternal(boolean) is false.
The default value is an empty string. A valid value must be a non-empty string.
String value.public void setContentType(java.lang.String value)
This property is applicable only when isExternal() / isExternal(boolean) is false.
The default value is an empty string. A valid value must be a non-empty string.
value - The corresponding String value.public byte[] getData()
This property is applicable only when isExternal() / isExternal(boolean) is false.
The default value is an empty byte array. The value cannot be null.
byte[] value.public void setData(byte[] value)
This property is applicable only when isExternal() / isExternal(boolean) is false.
The default value is an empty byte array. The value cannot be null.
value - The corresponding byte[] value.public CustomPart deepClone()
getData() / setData(byte[]) value.protected java.lang.Object memberwiseClone()