com.aspose.words
Class StructuredDocumentTag

com.aspose.words.CompositeNode
    extended by com.aspose.words.StructuredDocumentTag

public class StructuredDocumentTag 
extends com.aspose.words.CompositeNode

Represents a structured document tag (SDT or content control) in a document.

Structured document tags (SDTs) allow to embed customer-defined semantics as well as its behavior and appearance into a document.

In this version Aspose.Words provides a number of public methods and properties to manipulate the behavior and content of StructuredDocumentTag. Mapping of SDT nodes to custom XML packages within a document can be performed with using the XmlMapping property.

StructuredDocumentTag can occur in a document in the following places:


Property Getters/Setters Summary
java.lang.StringgetBuildingBlockCategory()
voidsetBuildingBlockCategory(java.lang.String value)
           Specifies category of building block for this SDT node. Can not be null.
java.lang.StringgetBuildingBlockGallery()
voidsetBuildingBlockGallery(java.lang.String value)
           Specifies type of building block for this SDT. Can not be null.
intgetCalendarType()
voidsetCalendarType(int value)
           Specifies the type of calendar for this SDT. Default is SdtCalendarType.DEFAULTThe value of the property is SdtCalendarType integer constant.
booleangetChecked()
voidsetChecked(boolean value)
           Gets/Sets current state of the Checkbox SDT. Default value for this property is false.
Aspose.Words.NodeCollectiongetChildNodes()→ inherited from Aspose.Words.CompositeNode
           Gets all immediate child nodes of this node.
Aspose.Words.FontgetContentsFont()
           Font formatting that will be applied to text entered into SDT.
intgetCount()→ inherited from Aspose.Words.CompositeNode
           Gets the number of immediate children of this node.
java.lang.StringgetDateDisplayFormat()
voidsetDateDisplayFormat(java.lang.String value)
           String that represents the format in which dates are displayed. Can not be null.

Example:

The dates for English (U.S.) is "mm/dd/yyyy"
intgetDateDisplayLocale()
voidsetDateDisplayLocale(int value)
           Allows to set/get the language format for the date displayed in this SDT.
intgetDateStorageFormat()
voidsetDateStorageFormat(int value)
           Gets/sets format in which the date for a date SDT is stored when the SDT is bound to an XML node in the document's data store. Default value is SdtDateStorageFormat.DATE_TIMEThe value of the property is SdtDateStorageFormat integer constant.
Aspose.Words.DocumentBasegetDocument()→ inherited from Aspose.Words.Node
           Gets the document to which this node belongs.
Aspose.Words.FontgetEndCharacterFont()
           Font formatting that will be applied to the last character of text entered into SDT.
Aspose.Words.NodegetFirstChild()→ inherited from Aspose.Words.CompositeNode
           Gets the first child of the node.
java.util.DategetFullDate()
voidsetFullDate(java.util.Date value)
           Specifies the full date and time last entered into this SDT.
booleanhasChildNodes()→ inherited from Aspose.Words.CompositeNode
           Returns true if this node has any child nodes.
intgetId()
          

Specifies a unique readonly persistent numerical Id for this SDT.

booleanisComposite()→ inherited from Aspose.Words.CompositeNode
           Returns true as this node can have child nodes.
booleanisShowingPlaceholderText()
voidisShowingPlaceholderText(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.

booleanisTemporary()
voidisTemporary(boolean value)
           Specifies whether this SDT shall be removed from the WordprocessingML document when its contents are modified.
Aspose.Words.NodegetLastChild()→ inherited from Aspose.Words.CompositeNode
           Gets the last child of the node.
intgetLevel()
           Gets the level at which this SDT occurs in the document tree. The value of the property is MarkupLevel integer constant.
SdtListItemCollectiongetListItems()
           Gets SdtListItemCollection associated with this SDT.
booleangetLockContentControl()
voidsetLockContentControl(boolean value)
           When set to true, this property will prohibit a user from deleting this SDT.
booleangetLockContents()
voidsetLockContents(boolean value)
           When set to true, this property will prohibit a user from editing the contents of this SDT.
booleangetMultiline()
voidsetMultiline(boolean value)
           Specifies whether this SDT allows multiple lines of text.
Aspose.Words.NodegetNextSibling()→ inherited from Aspose.Words.Node
           Gets the node immediately following this node.
Aspose.Words.NodeTypegetNodeType()
           Returns NodeType.StructuredDocumentTag.
Aspose.Words.CompositeNodegetParentNode()→ inherited from Aspose.Words.Node
           Gets the immediate parent of this node.
Aspose.Words.BuildingBlocks.BuildingBlockgetPlaceholder()
           Gets the Aspose.Words.BuildingBlocks.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 XmlMapping element or the IsShowingPlaceholderText element is true.
java.lang.StringgetPlaceholderName()
voidsetPlaceholderName(java.lang.String value)
          

Gets or sets Name of the Aspose.Words.BuildingBlocks.BuildingBlock containing placeholder text.

BuildingBlock with this name #Error Cref: P:Aspose.Words.BuildingBlocks.BuildingBlock.Name has to be present in the #Error Cref: P:Aspose.Words.Document.GlossaryDocument otherwise System.InvalidOperationException will occur.

Aspose.Words.NodegetPreviousSibling()→ inherited from Aspose.Words.Node
           Gets the node immediately preceding this node.
Aspose.Words.RangegetRange()→ inherited from Aspose.Words.Node
           Returns a Range object that represents the portion of a document that is contained in this node.
intgetSdtType()
           Gets type of this Structured document tag. The value of the property is SdtType integer constant.
java.lang.StringgetTag()
voidsetTag(java.lang.String value)
           Specifies a tag associated with the current SDT node. Can not be null.
java.lang.StringgetTitle()
voidsetTitle(java.lang.String value)
           Specifies the friendly name associated with this SDT. Can not be null.
XmlMappinggetXmlMapping()
           Gets an object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document.
 
Method Summary
Aspose.Words.NodedeepClone(boolean isCloneChildren)→ inherited from Aspose.Words.Node
           Creates a duplicate of the node.
Aspose.Words.CompositeNodegetAncestor(java.lang.Class ancestorType)→ inherited from Aspose.Words.Node
           Gets the first ancestor of the specified object type.
Aspose.Words.CompositeNodegetContainer()→ inherited from Aspose.Words.CompositeNode
          Reserved for internal use.
intgetLevel_IMarkupNode()
          Reserved for internal use.
Aspose.Words.NodegetNextMatchingNode(aspose.obfuscated.type curNode)→ inherited from Aspose.Words.CompositeNode
          Reserved for internal use.
java.lang.StringgetText()→ inherited from Aspose.Words.CompositeNode
           Gets the text of this node and of all its children.
java.util.Iteratoriterator()→ inherited from Aspose.Words.CompositeNode
           Provides support for the for each style iteration over the child nodes of this node.
voidremove()→ inherited from Aspose.Words.Node
           Removes itself from the parent.
voidremoveAllChildren()→ inherited from Aspose.Words.CompositeNode
           Removes all the child nodes of the current node.
voidremoveSelfOnly()
           Removes just this SDT node itself, but keeps the content of it inside the document tree.
voidremoveSmartTags()→ inherited from Aspose.Words.CompositeNode
           Removes all SmartTag descendant nodes of the current node.
Aspose.Words.NodeListselectNodes(java.lang.String xpath)→ inherited from Aspose.Words.CompositeNode
           Selects a list of nodes matching the XPath expression.
Aspose.Words.NodeselectSingleNode(java.lang.String xpath)→ inherited from Aspose.Words.CompositeNode
           Selects the first Node that matches the XPath expression.
java.lang.StringtoString(SaveOptions saveOptions)→ inherited from Aspose.Words.Node
           Exports the content of the node into a string using the specified save options.
java.lang.StringtoTxt()→ inherited from Aspose.Words.Node
           Exports the content of the node into a string in plain text format.
 

Property Getters/Setters Detail

getBuildingBlockCategory/setBuildingBlockCategory

public java.lang.String getBuildingBlockCategory() / public void setBuildingBlockCategory(java.lang.String value)
Specifies category of building block for this SDT node. Can not be null.

Accessing this property will only work for SdtType.BUILDING_BLOCK_GALLERY SDT type.

For all other SDT types exception will occur.


getBuildingBlockGallery/setBuildingBlockGallery

public java.lang.String getBuildingBlockGallery() / public void setBuildingBlockGallery(java.lang.String value)
Specifies type of building block for this SDT. Can not be null.

Accessing this property will only work for SdtType.BUILDING_BLOCK_GALLERY SDT type.

For all other SDT types exception will occur.


getCalendarType/setCalendarType

public int getCalendarType() / public void setCalendarType(int value)
Specifies the type of calendar for this SDT. Default is SdtCalendarType.DEFAULTThe value of the property is SdtCalendarType integer constant.

Accessing this property will only work for SdtType.DATE SDT type.

For all other SDT types exception will occur.


getChecked/setChecked

public boolean getChecked() / public void setChecked(boolean value)
Gets/Sets current state of the Checkbox SDT. Default value for this property is false.

Accessing this property will only work for SdtType.CHECKBOX SDT types.

For all other SDT types exception will occur.


getChildNodes

→ inherited from Aspose.Words.CompositeNode
public Aspose.Words.NodeCollection getChildNodes()
Gets all immediate child nodes of this node.

Note, #Error Cref: P:Aspose.Words.CompositeNode.ChildNodes is equivalent to calling GetChildNodes(NodeType.Any, false) and creates and returns a new collection every time it is accessed.

If there are no child nodes, this property returns an empty collection.


getContentsFont

public Aspose.Words.Font getContentsFont()
Font formatting that will be applied to text entered into SDT.

getCount

→ inherited from Aspose.Words.CompositeNode
public int getCount()
Gets the number of immediate children of this node.

getDateDisplayFormat/setDateDisplayFormat

public java.lang.String getDateDisplayFormat() / public void setDateDisplayFormat(java.lang.String value)
String that represents the format in which dates are displayed. Can not be null.

Example:

The dates for English (U.S.) is "mm/dd/yyyy"

Accessing this property will only work for SdtType.DATE SDT type.

For all other SDT types exception will occur.


getDateDisplayLocale/setDateDisplayLocale

public int getDateDisplayLocale() / public void setDateDisplayLocale(int value)
Allows to set/get the language format for the date displayed in this SDT.

Accessing this property will only work for SdtType.DATE SDT type.

For all other SDT types exception will occur.


getDateStorageFormat/setDateStorageFormat

public int getDateStorageFormat() / public void setDateStorageFormat(int value)
Gets/sets format in which the date for a date SDT is stored when the SDT is bound to an XML node in the document's data store. Default value is SdtDateStorageFormat.DATE_TIMEThe value of the property is SdtDateStorageFormat integer constant.

Accessing this property will only work for SdtType.DATE SDT type.

For all other SDT types exception will occur.


getDocument

→ inherited from Aspose.Words.Node
public Aspose.Words.DocumentBase getDocument()
Gets the document to which this node belongs.

The node always belongs to a document even if it has just been created and not yet added to the tree, or if it has been removed from the tree.


getEndCharacterFont

public Aspose.Words.Font getEndCharacterFont()
Font formatting that will be applied to the last character of text entered into SDT.

getFirstChild

→ inherited from Aspose.Words.CompositeNode
public Aspose.Words.Node getFirstChild()
Gets the first child of the node. If there is no first child node, a null is returned.

getFullDate/setFullDate

public java.util.Date getFullDate() / public void setFullDate(java.util.Date value)
Specifies the full date and time last entered into this SDT.

Accessing this property will only work for SdtType.DATE SDT type.

For all other SDT types exception will occur.


hasChildNodes

→ inherited from Aspose.Words.CompositeNode
public boolean hasChildNodes()
Returns true if this node has any child nodes.

getId

public int getId()

Specifies a unique readonly persistent numerical Id for this SDT.

Id attribute shall follow these rules:

  • The document shall retain SDT ids if the whole document is cloned #Error Cref: M:Aspose.Words.Document.Clone.
  • During #Error Cref: M:Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean) Id shall be retained if import does not cause conflicts with other SDT Ids in the target document.
  • If multiple SDT nodes specify the same decimal number value for the Id attribute, then the first SDT in the document shall maintain this original Id, and all subsequent SDT nodes shall have new identifiers assigned to them when the document is loaded.
  • During#Error Cref: M:Aspose.Words.Markup.StructuredDocumentTag.Clone(System.Boolean,Aspose.Words.INodeCloningListener) operation new unique ID will be generated for the cloned SDT node.
  • If Id is not specified in the source document, then the SDT node shall have a new unique identifier assigned to it when the document is loaded.


isComposite

→ inherited from Aspose.Words.CompositeNode
public boolean isComposite()
Returns true as this node can have child nodes.

isShowingPlaceholderText/isShowingPlaceholderText

public boolean isShowingPlaceholderText() / public 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.


isTemporary/isTemporary

public boolean isTemporary() / public void isTemporary(boolean value)
Specifies whether this SDT shall be removed from the WordprocessingML document when its contents are modified.

getLastChild

→ inherited from Aspose.Words.CompositeNode
public Aspose.Words.Node getLastChild()
Gets the last child of the node. If there is no last child node, a null is returned.

getLevel

public int getLevel()
Gets the level at which this SDT occurs in the document tree. The value of the property is MarkupLevel integer constant.

getListItems

public SdtListItemCollection getListItems()
Gets SdtListItemCollection associated with this SDT.

Accessing this property will only work for SdtType.COMBO_BOX or SdtType.DROP_DOWN_LIST SDT types.

For all other SDT types exception will occur.


getLockContentControl/setLockContentControl

public boolean getLockContentControl() / public void setLockContentControl(boolean value)
When set to true, this property will prohibit a user from deleting this SDT.

getLockContents/setLockContents

public boolean getLockContents() / public void setLockContents(boolean value)
When set to true, this property will prohibit a user from editing the contents of this SDT.

getMultiline/setMultiline

public boolean getMultiline() / public void setMultiline(boolean value)
Specifies whether this SDT allows multiple lines of text.

Accessing this property will only work for SdtType.RICH_TEXT and SdtType.PLAIN_TEXT SDT type.

For all other SDT types exception will occur.


getNextSibling

→ inherited from Aspose.Words.Node
public Aspose.Words.Node getNextSibling()
Gets the node immediately following this node. If there is no next node, a null is returned.

getNodeType

public Aspose.Words.NodeType getNodeType()
Returns NodeType.StructuredDocumentTag.

getParentNode

→ inherited from Aspose.Words.Node
public Aspose.Words.CompositeNode getParentNode()
Gets the immediate parent of this node.

If a node has just been created and not yet added to the tree, or if it has been removed from the tree, the parent is null.


getPlaceholder

public Aspose.Words.BuildingBlocks.BuildingBlock getPlaceholder()
Gets the Aspose.Words.BuildingBlocks.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 XmlMapping element or the IsShowingPlaceholderText element is true. Can be null, meaning that the placeholder is not applicable for this Sdt.

getPlaceholderName/setPlaceholderName

public java.lang.String getPlaceholderName() / public void setPlaceholderName(java.lang.String value)

Gets or sets Name of the Aspose.Words.BuildingBlocks.BuildingBlock containing placeholder text.

BuildingBlock with this name #Error Cref: P:Aspose.Words.BuildingBlocks.BuildingBlock.Name has to be present in the #Error Cref: P:Aspose.Words.Document.GlossaryDocument otherwise System.InvalidOperationException will occur.


getPreviousSibling

→ inherited from Aspose.Words.Node
public Aspose.Words.Node getPreviousSibling()
Gets the node immediately preceding this node. If there is no preceding node, a null is returned.

getRange

→ inherited from Aspose.Words.Node
public Aspose.Words.Range getRange()
Returns a Range object that represents the portion of a document that is contained in this node.

getSdtType

public int getSdtType()
Gets type of this Structured document tag. The value of the property is SdtType integer constant.

getTag/setTag

public java.lang.String getTag() / public void setTag(java.lang.String value)
Specifies a tag associated with the current SDT node. Can not be null. A tag is an arbitrary string which applications can associate with SDT in order to identify it without providing a visible friendly name.

getTitle/setTitle

public java.lang.String getTitle() / public void setTitle(java.lang.String value)
Specifies the friendly name associated with this SDT. Can not be null.

getXmlMapping

public 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. 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.

Method Detail

deepClone

→ inherited from Aspose.Words.Node
public Aspose.Words.Node deepClone(boolean isCloneChildren)
Creates a duplicate of the node.

This method serves as a copy constructor for nodes. The cloned node has no parent, but belongs to the same document as the original node.

This method always performs a deep copy of the node. The isCloneChildren parameter specifies whether to perform copy all child nodes as well.

Parameters:
isCloneChildren - True to recursively clone the subtree under the specified node; false to clone only the node itself.
Returns:
The cloned node.

getAncestor

→ inherited from Aspose.Words.Node
public Aspose.Words.CompositeNode getAncestor(java.lang.Class ancestorType)
Gets the first ancestor of the specified object type.

The ancestor type matches if it is equal to ancestorType or derived from ancestorType.

Parameters:
ancestorType - The object type of the ancestor to retrieve.
Returns:
The ancestor of the specified type or null if no ancestor of this type was found.

getContainer

→ inherited from Aspose.Words.CompositeNode
public Aspose.Words.CompositeNode getContainer()
Reserved for internal use.

getLevel_IMarkupNode

public int getLevel_IMarkupNode()
Reserved for internal use.

getNextMatchingNode

→ inherited from Aspose.Words.CompositeNode
public Aspose.Words.Node getNextMatchingNode(aspose.obfuscated.type curNode)
Reserved for internal use.

getText

→ inherited from Aspose.Words.CompositeNode
public java.lang.String getText()
Gets the text of this node and of all its children.

The returned string includes all control and special characters as described in Aspose.Words.ControlChar.


iterator

→ inherited from Aspose.Words.CompositeNode
public java.util.Iterator iterator()
Provides support for the for each style iteration over the child nodes of this node.

remove

→ inherited from Aspose.Words.Node
public void remove()
Removes itself from the parent.

removeAllChildren

→ inherited from Aspose.Words.CompositeNode
public void removeAllChildren()
Removes all the child nodes of the current node.

removeSelfOnly

public void removeSelfOnly()
                   throws java.lang.Exception
Removes just this SDT node itself, but keeps the content of it inside the document tree.

removeSmartTags

→ inherited from Aspose.Words.CompositeNode
public void removeSmartTags()
Removes all SmartTag descendant nodes of the current node. This method does not remove the content of the smart tags.

selectNodes

→ inherited from Aspose.Words.CompositeNode
public Aspose.Words.NodeList selectNodes(java.lang.String xpath)
Selects a list of nodes matching the XPath expression.

Only expressions with element names are supported at the moment. Expressions that use attribute names are not supported.

Parameters:
xpath - The XPath expression.
Returns:
A list of nodes matching the XPath query.

selectSingleNode

→ inherited from Aspose.Words.CompositeNode
public Aspose.Words.Node selectSingleNode(java.lang.String xpath)
Selects the first Node that matches the XPath expression.

Only expressions with element names are supported at the moment. Expressions that use attribute names are not supported.

Parameters:
xpath - The XPath expression.
Returns:
The first Node that matches the XPath query or null if no matching node is found.

toString

→ inherited from Aspose.Words.Node
public java.lang.String toString(SaveOptions saveOptions)
               throws java.lang.Exception
Exports the content of the node into a string using the specified save options.
Parameters:
saveOptions - Specifies the options that control how the node is saved.
Returns:
The content of the node in the specified format.

toTxt

→ inherited from Aspose.Words.Node
public java.lang.String toTxt()
            throws java.lang.Exception
Exports the content of the node into a string in plain text format.

This method removes field codes and Microsoft Word control characters, uses CrLf (or any other) combination of characters to mark ends of paragraphs in the resulting string. It produces a different result from #Error Cref: M:Aspose.Words.Node.GetText which just gets the text from the node without removing field codes or special characters.

Returns:
The content of the node in plain text format.
See Also:
TxtSaveOptions.ParagraphBreak, TxtSaveOptions.ExportHeadersFooters

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.