public class StructuredDocumentTag extends CompositeNode implements IStructuredDocumentTag
To learn more, visit the Structured Document Tags or Content Control documentation article.
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 getXmlMapping() property.
StructuredDocumentTag can occur in a document in the following places:
Body, HeaderFooter, Comment, Footnote or a Shape node.
Table node.
Row node.
Paragraph.
StructuredDocumentTag.
| Constructor and Description |
|---|
StructuredDocumentTag(DocumentBase doc,
int type,
int level)
Initializes a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(DocumentVisitor visitor)
Accepts a visitor.
|
void |
clear()
Clears contents of this structured document tag and displays a placeholder if it is defined.
|
void |
clearRunAttrs() |
java.lang.Object |
fetchInheritedRunAttr(int key) |
int |
getAppearance()
Gets/sets the appearance of a structured document tag.
|
java.lang.String |
getBuildingBlockCategory()
Specifies category of building block for this SDT node.
|
java.lang.String |
getBuildingBlockGallery()
Specifies type of building block for this SDT.
|
int |
getCalendarType()
Specifies the type of calendar for this SDT.
|
boolean |
getChecked()
Gets/Sets current state of the Checkbox SDT.
|
java.awt.Color |
getColor()
Gets the color of the structured document tag.
|
Font |
getContentsFont()
Font formatting that will be applied to text entered into SDT.
|
java.lang.String |
getDateDisplayFormat()
String that represents the format in which dates are displayed.
|
int |
getDateDisplayLocale()
Allows to set/get the language format for the date displayed in this SDT.
|
int |
getDateStorageFormat()
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.
|
java.lang.Object |
getDirectRunAttr(int key) |
Font |
getEndCharacterFont()
Font formatting that will be applied to the last character of text entered into SDT.
|
java.util.Date |
getFullDate()
Specifies the full date and time last entered into this SDT.
|
int |
getId()
Specifies a unique read-only persistent numerical Id for this SDT.
|
int |
getLevel_IMarkupNode() |
int |
getLevel()
Gets the level at which this SDT occurs in the document tree.
|
SdtListItemCollection |
getListItems()
Gets
SdtListItemCollection associated with this SDT. |
boolean |
getLockContentControl()
When set to true, this property will prohibit a user from deleting this SDT.
|
boolean |
getLockContents()
When set to true, this property will prohibit a user from editing the contents of this SDT.
|
boolean |
getMultiline()
Specifies whether this SDT allows multiple lines of text.
|
int |
getNodeType()
Returns NodeType.StructuredDocumentTag.
|
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. |
java.lang.String |
getPlaceholderName()
Gets or sets Name of the
BuildingBlock containing placeholder text. |
int |
getSdtType()
Gets type of this Structured document tag.
|
Style |
getStyle()
Gets the Style of the structured document tag.
|
java.lang.String |
getStyleName()
Gets the name of the style applied to the structured document tag.
|
java.lang.String |
getTag()
Specifies a tag associated with the current SDT node.
|
java.lang.String |
getTitle()
Specifies the friendly name associated with this SDT.
|
java.lang.String |
getWordOpenXML()
Gets a string that represents the XML contained within the node in the
SaveFormat.FLAT_OPC format. |
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.
|
boolean |
isRanged()
Returns true if this instance is a ranged structured document tag.
|
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).
|
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).
|
boolean |
isTemporary()
Specifies whether this SDT shall be removed from the WordProcessingML document when its contents are modified.
|
void |
isTemporary(boolean value)
Specifies whether this SDT shall be removed from the WordProcessingML document when its contents are modified.
|
void |
removeMoveRevisions() |
void |
removeRunAttr(int key) |
void |
removeSelfOnly()
Removes just this SDT node itself, but keeps the content of it inside the document tree.
|
void |
setAppearance(int value)
Gets/sets the appearance of a structured document tag.
|
void |
setBuildingBlockCategory(java.lang.String value)
Specifies category of building block for this SDT node.
|
void |
setBuildingBlockGallery(java.lang.String value)
Specifies type of building block for this SDT.
|
void |
setCalendarType(int value)
Specifies the type of calendar for this SDT.
|
void |
setChecked(boolean value)
Gets/Sets current state of the Checkbox SDT.
|
void |
setCheckedSymbol(int characterCode,
java.lang.String fontName)
Sets the symbol used to represent the checked state of a check box content control.
|
void |
setColor(java.awt.Color value)
Sets the color of the structured document tag.
|
void |
setDateDisplayFormat(java.lang.String value)
String that represents the format in which dates are displayed.
|
void |
setDateDisplayLocale(int value)
Allows to set/get the language format for the date displayed in this SDT.
|
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.
|
void |
setFullDate(java.util.Date value)
Specifies the full date and time last entered into this SDT.
|
void |
setLockContentControl(boolean value)
When set to true, this property will prohibit a user from deleting this SDT.
|
void |
setLockContents(boolean value)
When set to true, this property will prohibit a user from editing the contents of this SDT.
|
void |
setMultiline(boolean value)
Specifies whether this SDT allows multiple lines of text.
|
void |
setPlaceholderName(java.lang.String value)
Gets or sets Name of the
BuildingBlock containing placeholder text. |
void |
setRunAttr(int key,
java.lang.Object value) |
void |
setStyle(Style value)
Sets the Style of the structured document tag.
|
void |
setStyleName(java.lang.String value)
Sets the name of the style applied to the structured document tag.
|
void |
setTag(java.lang.String value)
Specifies a tag associated with the current SDT node.
|
void |
setTitle(java.lang.String value)
Specifies the friendly name associated with this SDT.
|
void |
setUncheckedSymbol(int characterCode,
java.lang.String fontName)
Sets the symbol used to represent the unchecked state of a check box content control.
|
Node |
structuredDocumentTagNode()
Returns Node object that implements this interface.
|
acceptChildren, acceptCore, appendChild, coreRemoveSelfOnly, getChild, getChildNodes, getChildNodes, getContainer, getCount, getCurrentNode, getFirstChild, getLastChild, getNextMatchingNode, getText, hasChildNodes, indexOf, insertAfter, insertBefore, isComposite, iterator, prependChild, removeAllChildren, removeChild, removeSmartTags, selectNodes, selectSingleNodedd, deepClone, getAncestor, getAncestor, getCustomNodeId, getDocument, getNextSibling, getParentNode, getPreviousSibling, getRange, memberwiseClone, nextPreOrder, nodeTypeToString, previousPreOrder, remove, setCustomNodeId, toString, toString, toString, visitorActionToBoolpublic StructuredDocumentTag(DocumentBase doc, int type, int level)
public void setCheckedSymbol(int characterCode,
java.lang.String fontName)
throws java.lang.Exception
characterCode - The character code for the specified symbol.fontName - The name of the font that contains the symbol.java.lang.Exceptionpublic void setUncheckedSymbol(int characterCode,
java.lang.String fontName)
throws java.lang.Exception
characterCode - The character code for the specified symbol.fontName - The name of the font that contains the symbol.java.lang.Exceptionpublic void removeSelfOnly()
throws java.lang.Exception
java.lang.Exceptionpublic boolean accept(DocumentVisitor visitor) throws java.lang.Exception
Enumerates over this node and all of its children. Each node calls a corresponding method on DocumentVisitor.
For more info see the Visitor design pattern.
public void clear()
throws java.lang.Exception
It is not possible to clear contents of a structured document tag if it has revisions.
If this structured document tag is mapped to custom XML (with using the getXmlMapping() property), the referenced XML node is cleared.
java.lang.Exceptionpublic boolean isRanged()
IStructuredDocumentTagisRanged in interface IStructuredDocumentTagpublic Node structuredDocumentTagNode()
IStructuredDocumentTagstructuredDocumentTagNode in interface IStructuredDocumentTagpublic int getNodeType()
getNodeType in class NodeNodeType constants.public BuildingBlock getPlaceholder()
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.
Can be null, meaning that the placeholder is not applicable for this Sdt.getPlaceholder in interface IStructuredDocumentTagBuildingBlock 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.public java.lang.String getPlaceholderName()
Gets or sets Name of the BuildingBlock containing placeholder text.
BuildingBlock with this name BuildingBlock.getName() / BuildingBlock.setName(java.lang.String) has to be present in the Document.getGlossaryDocument() / Document.setGlossaryDocument(com.aspose.words.GlossaryDocument) otherwise IllegalStateException will occur.
getPlaceholderName in interface IStructuredDocumentTagString value.public void setPlaceholderName(java.lang.String value)
Gets or sets Name of the BuildingBlock containing placeholder text.
BuildingBlock with this name BuildingBlock.getName() / BuildingBlock.setName(java.lang.String) has to be present in the Document.getGlossaryDocument() / Document.setGlossaryDocument(com.aspose.words.GlossaryDocument) otherwise IllegalStateException will occur.
setPlaceholderName in interface IStructuredDocumentTagvalue - The corresponding String value.public int getLevel()
getLevel in interface IStructuredDocumentTagMarkupLevel constants.public int getSdtType()
getSdtType in interface IStructuredDocumentTagSdtType constants.public int getId()
Specifies a unique read-only persistent numerical Id for this SDT.
Id attribute shall follow these rules:
Document.deepClone().
DocumentBase.importNode(com.aspose.words.Node, boolean) Id shall be retained if import does not cause conflicts with other SDT Ids in the target document.
getId in interface IStructuredDocumentTagint value.public boolean getLockContentControl()
getLockContentControl in interface IStructuredDocumentTagboolean value.public void setLockContentControl(boolean value)
setLockContentControl in interface IStructuredDocumentTagvalue - The corresponding boolean value.public boolean getLockContents()
getLockContents in interface IStructuredDocumentTagboolean value.public void setLockContents(boolean value)
setLockContents in interface IStructuredDocumentTagvalue - The corresponding boolean value.public 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.
isShowingPlaceholderText in interface IStructuredDocumentTagboolean value.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.
isShowingPlaceholderText in interface IStructuredDocumentTagvalue - The corresponding boolean value.public java.lang.String getTag()
getTag in interface IStructuredDocumentTagString value.public void setTag(java.lang.String value)
setTag in interface IStructuredDocumentTagvalue - The corresponding String value.public Font getContentsFont()
Font value.public Font getEndCharacterFont()
Font value.public boolean isTemporary()
boolean value.public void isTemporary(boolean value)
value - The corresponding boolean value.public java.lang.String getTitle()
getTitle in interface IStructuredDocumentTagString value.public void setTitle(java.lang.String value)
setTitle in interface IStructuredDocumentTagvalue - The corresponding String value.public SdtListItemCollection getListItems()
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.
SdtListItemCollection associated with this SDT.public boolean getChecked()
Accessing this property will only work for SdtType.CHECKBOX SDT types.
For all other SDT types exception will occur.
boolean value.public void setChecked(boolean value)
throws java.lang.Exception
Accessing this property will only work for SdtType.CHECKBOX SDT types.
For all other SDT types exception will occur.
value - The corresponding boolean value.java.lang.Exceptionpublic int getAppearance()
int value. The returned value is one of SdtAppearance constants.public void setAppearance(int value)
value - The corresponding int value. The value must be one of SdtAppearance constants.public int getDateDisplayLocale()
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
int value.public void setDateDisplayLocale(int value)
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
value - The corresponding int value.public java.lang.String getDateDisplayFormat()
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
String value.public void setDateDisplayFormat(java.lang.String value)
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
value - The corresponding String value.public java.util.Date getFullDate()
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
Date value.public void setFullDate(java.util.Date value)
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
value - The corresponding Date value.public int getDateStorageFormat()
SdtDateStorageFormat.DATE_TIME
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
int value. The returned value is one of SdtDateStorageFormat constants.public void setDateStorageFormat(int value)
SdtDateStorageFormat.DATE_TIME
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
value - The corresponding int value. The value must be one of SdtDateStorageFormat constants.public int getCalendarType()
SdtCalendarType.DEFAULT
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
int value. The returned value is one of SdtCalendarType constants.public void setCalendarType(int value)
SdtCalendarType.DEFAULT
Accessing this property will only work for SdtType.DATE SDT type.
For all other SDT types exception will occur.
value - The corresponding int value. The value must be one of SdtCalendarType constants.public java.lang.String getBuildingBlockGallery()
Accessing this property will only work for SdtType.BUILDING_BLOCK_GALLERY and SdtType.DOC_PART_OBJ SDT types. It is read-only for SDT of the document part type.
For all other SDT types exception will occur.
String value.public void setBuildingBlockGallery(java.lang.String value)
Accessing this property will only work for SdtType.BUILDING_BLOCK_GALLERY and SdtType.DOC_PART_OBJ SDT types. It is read-only for SDT of the document part type.
For all other SDT types exception will occur.
value - The corresponding String value.public java.lang.String getBuildingBlockCategory()
Accessing this property will only work for SdtType.BUILDING_BLOCK_GALLERY and SdtType.DOC_PART_OBJ SDT types. It is read-only for SDT of the document part type.
For all other SDT types exception will occur.
String value.public void setBuildingBlockCategory(java.lang.String value)
Accessing this property will only work for SdtType.BUILDING_BLOCK_GALLERY and SdtType.DOC_PART_OBJ SDT types. It is read-only for SDT of the document part type.
For all other SDT types exception will occur.
value - The corresponding String value.public boolean getMultiline()
Accessing this property will only work for SdtType.RICH_TEXT and SdtType.PLAIN_TEXT SDT type.
For all other SDT types exception will occur.
boolean value.public void setMultiline(boolean value)
Accessing this property will only work for SdtType.RICH_TEXT and SdtType.PLAIN_TEXT SDT type.
For all other SDT types exception will occur.
value - The corresponding boolean value.public java.awt.Color getColor()
getColor in interface IStructuredDocumentTagpublic void setColor(java.awt.Color value)
setColor in interface IStructuredDocumentTagvalue - The color of the structured document tag.public Style getStyle()
StyleType.CHARACTER style or StyleType.PARAGRAPH style with linked character style can be set.public void setStyle(Style value)
StyleType.CHARACTER style or StyleType.PARAGRAPH style with linked character style can be set.value - The Style of the structured document tag.public java.lang.String getStyleName()
public void setStyleName(java.lang.String value)
value - The name of the style applied to the structured document tag.public XmlMapping getXmlMapping()
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.getXmlMapping in interface IStructuredDocumentTagpublic java.lang.String getWordOpenXML()
throws java.lang.Exception
SaveFormat.FLAT_OPC format.getWordOpenXML in interface IStructuredDocumentTagSaveFormat.FLAT_OPC format.java.lang.Exceptionpublic int getLevel_IMarkupNode()
public void removeMoveRevisions()
public java.lang.Object getDirectRunAttr(int key)
public java.lang.Object fetchInheritedRunAttr(int key)
public void setRunAttr(int key,
java.lang.Object value)
public void removeRunAttr(int key)
public void clearRunAttrs()