IStructuredDocumentTag

public interface IStructuredDocumentTag

Interface to define a common data for StructuredDocumentTag and StructuredDocumentTagRangeStart.

Methods

MethodDescription
getAppearance()Gets the appearance of the structured document tag.
getChildNodes(int nodeType, boolean isDeep)
getColor()Gets the color of the structured document tag.
getId()Specifies a unique read-only persistent numerical Id for this SDT.
getLevel()Gets the level at which this SDT occurs in the document tree.
getLockContentControl()When set to true, this property will prohibit a user from deleting this SDT.
getLockContents()When set to true, this property will prohibit a user from editing the contents of this SDT.
getNode()Returns Node object that implements this interface.
getPlaceholder()Gets the BuildingBlock containing placeholder text which should be displayed when this SDT run contents are empty, the associated mapped XML element is empty as specified via the getXmlMapping() element or the isShowingPlaceholderText() / isShowingPlaceholderText(boolean) element is true.
getPlaceholderName()Gets or sets Name of the BuildingBlock containing placeholder text.
getSdtType()Gets type of this Structured document tag.
getTag()Specifies a tag associated with the current SDT node.
getTitle()Specifies the friendly name associated with this SDT.
getWordOpenXML()Gets a string that represents the XML contained within the node in the SaveFormat.FLAT_OPC format.
getXmlMapping()Gets an object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document.
isMultiSection()Returns true if this instance is a ranged (multi-section) structured document tag.
isRanged()Returns true if this instance is a ranged structured document tag.
isShowingPlaceholderText()Specifies whether the content of this SDT shall be interpreted to contain placeholder text (as opposed to regular text contents within the SDT).
isShowingPlaceholderText(boolean value)Specifies whether the content of this SDT shall be interpreted to contain placeholder text (as opposed to regular text contents within the SDT).
removeSelfOnly()Removes just this SDT node itself, but keeps the content of it inside the document tree.
setAppearance(int value)Sets the appearance of the structured document tag.
setColor(Color value)Sets the color of the structured document tag.
setLockContentControl(boolean value)When set to true, this property will prohibit a user from deleting this SDT.
setLockContents(boolean value)When set to true, this property will prohibit a user from editing the contents of this SDT.
setPlaceholderName(String value)Gets or sets Name of the BuildingBlock containing placeholder text.
setTag(String value)Specifies a tag associated with the current SDT node.
setTitle(String value)Specifies the friendly name associated with this SDT.
structuredDocumentTagNode()Returns Node object that implements this interface.

getAppearance()

public abstract int getAppearance()

Gets the appearance of the structured document tag.

Returns: int - The appearance of the structured document tag. The returned value is one of SdtAppearance constants.

getChildNodes(int nodeType, boolean isDeep)

public abstract NodeCollection getChildNodes(int nodeType, boolean isDeep)

Parameters:

ParameterTypeDescription
nodeTypeint
isDeepboolean

Returns: NodeCollection

getColor()

public abstract Color getColor()

Gets the color of the structured document tag.

Returns: java.awt.Color - The color of the structured document tag.

getId()

public abstract int getId()

Specifies a unique read-only persistent numerical Id for this SDT.

Returns: int - The corresponding int value.

getLevel()

public abstract int getLevel()

Gets the level at which this SDT occurs in the document tree.

Returns: int - The level at which this SDT occurs in the document tree. The returned value is one of MarkupLevel constants.

getLockContentControl()

public abstract boolean getLockContentControl()

When set to true, this property will prohibit a user from deleting this SDT.

Returns: boolean - The corresponding boolean value.

getLockContents()

public abstract boolean getLockContents()

When set to true, this property will prohibit a user from editing the contents of this SDT.

Returns: boolean - The corresponding boolean value.

getNode()

public abstract Node getNode()

Returns Node object that implements this interface.

Returns: Node - Node object that implements this interface.

getPlaceholder()

public abstract BuildingBlock getPlaceholder()

Gets the BuildingBlock containing placeholder text which should be displayed when this SDT run contents are empty, the associated mapped XML element is empty as specified via the getXmlMapping() element or the isShowingPlaceholderText() / isShowingPlaceholderText(boolean) element is true.

Remarks:

Can be null, meaning that the placeholder is not applicable for this Sdt.

Returns: BuildingBlock - The BuildingBlock containing placeholder text which should be displayed when this SDT run contents are empty, the associated mapped XML element is empty as specified via the getXmlMapping() element or the isShowingPlaceholderText() / isShowingPlaceholderText(boolean) element is true.

getPlaceholderName()

public abstract String getPlaceholderName()

Gets or sets Name of the BuildingBlock containing placeholder text.

Returns: java.lang.String - The corresponding java.lang.String value.

getSdtType()

public abstract int getSdtType()

Gets type of this Structured document tag.

Returns: int - Type of this Structured document tag. The returned value is one of SdtType constants.

getTag()

public abstract String getTag()

Specifies a tag associated with the current SDT node. Can not be null.

Returns: java.lang.String - The corresponding java.lang.String value.

getTitle()

public abstract String getTitle()

Specifies the friendly name associated with this SDT. Can not be null.

Examples:

Shows how to get structured document tag.


 Document doc = new Document(getMyDir() + "Structured document tags by id.docx");

 // Get the structured document tag by Id.
 IStructuredDocumentTag sdt = doc.getRange().getStructuredDocumentTags().getById(1160505028);
 System.out.println(sdt.isMultiSection());
 System.out.println(sdt.getTitle());

 // Get the structured document tag or ranged tag by Title.
 sdt = doc.getRange().getStructuredDocumentTags().getByTitle("Alias4");
 System.out.println(sdt.getId());
 

Returns: java.lang.String - The corresponding java.lang.String value.

getWordOpenXML()

public abstract String getWordOpenXML()

Gets a string that represents the XML contained within the node in the SaveFormat.FLAT_OPC format.

Returns: java.lang.String - A string that represents the XML contained within the node in the SaveFormat.FLAT_OPC format.

getXmlMapping()

public abstract XmlMapping getXmlMapping()

Gets an object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document.

Remarks:

You can use the XmlMapping.setMapping(com.aspose.words.CustomXmlPart, java.lang.String, java.lang.String) method of this object to map a structured document tag to XML data.

Returns: XmlMapping - An object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document.

isMultiSection()

public abstract boolean isMultiSection()

Returns true if this instance is a ranged (multi-section) structured document tag.

Examples:

Shows how to get structured document tag.


 Document doc = new Document(getMyDir() + "Structured document tags by id.docx");

 // Get the structured document tag by Id.
 IStructuredDocumentTag sdt = doc.getRange().getStructuredDocumentTags().getById(1160505028);
 System.out.println(sdt.isMultiSection());
 System.out.println(sdt.getTitle());

 // Get the structured document tag or ranged tag by Title.
 sdt = doc.getRange().getStructuredDocumentTags().getByTitle("Alias4");
 System.out.println(sdt.getId());
 

Returns: boolean - True if this instance is a ranged (multi-section) structured document tag.

isRanged()

public abstract boolean isRanged()

Returns true if this instance is a ranged structured document tag.

Returns: boolean

isShowingPlaceholderText()

public abstract boolean isShowingPlaceholderText()

Specifies whether the content of this SDT shall be interpreted to contain placeholder text (as opposed to regular text contents within the SDT).

if set to true, this state shall be resumed (showing placeholder text) upon opening this document.

Returns: boolean - The corresponding boolean value.

isShowingPlaceholderText(boolean value)

public abstract void isShowingPlaceholderText(boolean value)

Specifies whether the content of this SDT shall be interpreted to contain placeholder text (as opposed to regular text contents within the SDT).

if set to true, this state shall be resumed (showing placeholder text) upon opening this document.

Parameters:

ParameterTypeDescription
valuebooleanThe corresponding boolean value.

removeSelfOnly()

public abstract void removeSelfOnly()

Removes just this SDT node itself, but keeps the content of it inside the document tree.

Examples:

Shows how to remove structured document tag, but keeps content inside.


 Document doc = new Document(getMyDir() + "Structured document tags.docx");

 // This collection provides a unified interface for accessing ranged and non-ranged structured tags.
 StructuredDocumentTagCollection sdts = doc.getRange().getStructuredDocumentTags();
 Assert.assertEquals(5, sdts.getCount());

 // Here we can get child nodes from the common interface of ranged and non-ranged structured tags.
 for (IStructuredDocumentTag sdt : sdts)
     if (sdt.getChildNodes(NodeType.ANY, false).getCount() > 0)
         sdt.removeSelfOnly();

 sdts = doc.getRange().getStructuredDocumentTags();
 Assert.assertEquals(0, sdts.getCount());
 

setAppearance(int value)

public abstract void setAppearance(int value)

Sets the appearance of the structured document tag.

Parameters:

ParameterTypeDescription
valueintThe appearance of the structured document tag. The value must be one of SdtAppearance constants.

setColor(Color value)

public abstract void setColor(Color value)

Sets the color of the structured document tag.

Parameters:

ParameterTypeDescription
valuejava.awt.ColorThe color of the structured document tag.

setLockContentControl(boolean value)

public abstract void setLockContentControl(boolean value)

When set to true, this property will prohibit a user from deleting this SDT.

Parameters:

ParameterTypeDescription
valuebooleanThe corresponding boolean value.

setLockContents(boolean value)

public abstract void setLockContents(boolean value)

When set to true, this property will prohibit a user from editing the contents of this SDT.

Parameters:

ParameterTypeDescription
valuebooleanThe corresponding boolean value.

setPlaceholderName(String value)

public abstract void setPlaceholderName(String value)

Gets or sets Name of the BuildingBlock containing placeholder text.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe corresponding java.lang.String value.

setTag(String value)

public abstract void setTag(String value)

Specifies a tag associated with the current SDT node. Can not be null.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe corresponding java.lang.String value.

setTitle(String value)

public abstract void setTitle(String value)

Specifies the friendly name associated with this SDT. Can not be null.

Examples:

Shows how to get structured document tag.


 Document doc = new Document(getMyDir() + "Structured document tags by id.docx");

 // Get the structured document tag by Id.
 IStructuredDocumentTag sdt = doc.getRange().getStructuredDocumentTags().getById(1160505028);
 System.out.println(sdt.isMultiSection());
 System.out.println(sdt.getTitle());

 // Get the structured document tag or ranged tag by Title.
 sdt = doc.getRange().getStructuredDocumentTags().getByTitle("Alias4");
 System.out.println(sdt.getId());
 

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe corresponding java.lang.String value.

structuredDocumentTagNode()

public abstract Node structuredDocumentTagNode()

Returns Node object that implements this interface.

Returns: Node