Aspose::Words::Markup::StructuredDocumentTag class
Contents
[
Hide
]StructuredDocumentTag class
Represents a structured document tag (SDT or content control) in a document. To learn more, visit the Structured Document Tags or Content Control documentation article.
class StructuredDocumentTag : public Aspose::Words::CompositeNode,
public Aspose::Words::Markup::IMarkupNode,
public Aspose::Words::Revisions::ITrackableNode,
public Aspose::Words::IRunAttrSource,
public Aspose::Words::Markup::IStructuredDocumentTag
Methods
Method | Description |
---|---|
Accept(System::SharedPtr<Aspose::Words::DocumentVisitor>) override | Accepts a visitor. |
AcceptEnd(System::SharedPtr<Aspose::Words::DocumentVisitor>) override | Accepts a visitor for visiting the end of the StructuredDocumentTag. |
AcceptStart(System::SharedPtr<Aspose::Words::DocumentVisitor>) override | Accepts a visitor for visiting the start of the StructuredDocumentTag. |
AppendChild(T) | |
Clear() | Clears contents of this structured document tag and displays a placeholder if it is defined. |
Clone(bool) | Creates a duplicate of the node. |
get_Appearance() override | Gets/sets the appearance of a structured document tag. |
get_BuildingBlockCategory() | Specifies category of building block for this SDT node. Can not be null. |
get_BuildingBlockGallery() | Specifies type of building block for this SDT. Can not be null. |
get_CalendarType() | Specifies the type of calendar for this SDT. Default is Default |
get_Checked() | Gets/Sets current state of the Checkbox SDT. Default value for this property is false. |
get_Color() override | Gets or sets the color of the structured document tag. |
get_ContentsFont() | Font formatting that will be applied to text entered into SDT. |
get_Count() | Gets the number of immediate children of this node. |
get_CustomNodeId() const | Specifies custom node identifier. |
get_DateDisplayFormat() | String that represents the format in which dates are displayed. |
get_DateDisplayLocale() | Allows to set/get the language format for the date displayed in this SDT. |
get_DateStorageFormat() | 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 DateTime |
virtual get_Document() const | Gets the document to which this node belongs. |
get_EndCharacterFont() | Font formatting that will be applied to the last character of text entered into SDT. |
get_FirstChild() const | Gets the first child of the node. |
get_FullDate() | Specifies the full date and time last entered into this SDT. |
get_HasChildNodes() | Returns true if this node has any child nodes. |
get_Id() override | Specifies a unique read-only persistent numerical Id for this SDT. |
get_IsComposite() override | Returns true as this node can have child nodes. |
get_IsShowingPlaceholderText() override | 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. |
get_IsTemporary() const | Specifies whether this SDT shall be removed from the WordProcessingML document when its contents are modified. |
get_LastChild() const | Gets the last child of the node. |
get_Level() const override | Gets the level at which this SDT occurs in the document tree. |
get_ListItems() | Gets SdtListItemCollection associated with this SDT. |
get_LockContentControl() override | When set to true, this property will prohibit a user from deleting this SDT. |
get_LockContents() override | When set to true, this property will prohibit a user from editing the contents of this SDT. |
get_Multiline() | Specifies whether this SDT allows multiple lines of text. |
get_NextNode() const | |
get_NextSibling() | Gets the node immediately following this node. |
get_NodeType() const override | Returns StructuredDocumentTag. |
get_ParentNode() | Gets the immediate parent of this node. |
get_Placeholder() override | 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 XmlMapping element or the IsShowingPlaceholderText element is true. |
get_PlaceholderName() override | Gets or sets Name of the BuildingBlock containing placeholder text. |
get_PreviousSibling() | Gets the node immediately preceding this node. |
get_PrevNode() const | |
get_Range() | Returns a Range object that represents the portion of a document that is contained in this node. |
get_SdtType() override | Gets type of this Structured document tag. |
get_Style() | Gets or sets the Style of the structured document tag. |
get_StyleName() | Gets or sets the name of the style applied to the structured document tag. |
get_Tag() const override | Specifies a tag associated with the current SDT node. Can not be null. |
get_Title() const override | Specifies the friendly name associated with this SDT. Can not be null. |
get_WordOpenXML() override | Gets a string that represents the XML contained within the node in the FlatOpc format. |
get_WordOpenXMLMinimal() | Gets a string that represents the XML contained within the node in the FlatOpc format. Unlike the WordOpenXML property, this method generates a stripped-down document that excludes any non-content-related parts. |
get_XmlMapping() override | Gets an object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document. |
GetAncestor(Aspose::Words::NodeType) | Gets the first ancestor of the specified NodeType. |
GetAncestorOf() | |
GetChild(Aspose::Words::NodeType, int32_t, bool) | Returns an Nth child node that matches the specified type. |
GetChildNodes(Aspose::Words::NodeType, bool) override | Returns a live collection of child nodes that match the specified type. |
GetEnumerator() override | Provides support for the for each style iteration over the child nodes of this node. |
GetText() override | Gets the text of this node and of all its children. |
GetType() const override | |
IndexOf(const System::SharedPtr<Aspose::Words::Node>&) | Returns the index of the specified child node in the child node array. |
InsertAfter(T, const System::SharedPtr<Aspose::Words::Node>&) | |
InsertBefore(T, const System::SharedPtr<Aspose::Words::Node>&) | |
Is(const System::TypeInfo&) const override | |
IsAncestorNode(const System::SharedPtr<Aspose::Words::Node>&) | |
NextPreOrder(const System::SharedPtr<Aspose::Words::Node>&) | Gets next node according to the pre-order tree traversal algorithm. |
static NodeTypeToString(Aspose::Words::NodeType) | A utility method that converts a node type enum value into a user friendly string. |
PrependChild(T) | |
PreviousPreOrder(const System::SharedPtr<Aspose::Words::Node>&) | Gets the previous node according to the pre-order tree traversal algorithm. |
Remove() | Removes itself from the parent. |
RemoveAllChildren() | Removes all the child nodes of the current node. |
RemoveChild(T) | |
RemoveSelfOnly() override | Removes just this SDT node itself, but keeps the content of it inside the document tree. |
RemoveSmartTags() | Removes all SmartTag descendant nodes of the current node. |
SelectNodes(const System::String&) | Selects a list of nodes matching the XPath expression. |
SelectSingleNode(const System::String&) | Selects the first Node that matches the XPath expression. |
set_Appearance(Aspose::Words::Markup::SdtAppearance) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_Appearance. |
set_BuildingBlockCategory(const System::String&) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_BuildingBlockCategory. |
set_BuildingBlockGallery(const System::String&) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_BuildingBlockGallery. |
set_CalendarType(Aspose::Words::Markup::SdtCalendarType) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_CalendarType. |
set_Checked(bool) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_Checked. |
set_Color(System::Drawing::Color) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_Color. |
set_CustomNodeId(int32_t) | Setter for Aspose::Words::Node::get_CustomNodeId. |
set_DateDisplayFormat(const System::String&) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_DateDisplayFormat. |
set_DateDisplayLocale(int32_t) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_DateDisplayLocale. |
set_DateStorageFormat(Aspose::Words::Markup::SdtDateStorageFormat) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_DateStorageFormat. |
set_FullDate(System::DateTime) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_FullDate. |
set_IsShowingPlaceholderText(bool) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_IsShowingPlaceholderText. |
set_IsTemporary(bool) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_IsTemporary. |
set_LockContentControl(bool) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_LockContentControl. |
set_LockContents(bool) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_LockContents. |
set_Multiline(bool) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_Multiline. |
set_NextNode(const System::SharedPtr<Aspose::Words::Node>&) | |
set_PlaceholderName(System::String) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_PlaceholderName. |
set_PrevNode(const System::SharedPtr<Aspose::Words::Node>&) | |
set_Style(const System::SharedPtr<Aspose::Words::Style>&) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_Style. |
set_StyleName(const System::String&) | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_StyleName. |
set_Tag(System::String) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_Tag. |
set_Title(System::String) override | Setter for Aspose::Words::Markup::StructuredDocumentTag::get_Title. |
SetCheckedSymbol(int32_t, const System::String&) | Sets the symbol used to represent the checked state of a check box content control. |
SetParent(const System::SharedPtr<Aspose::Words::Node>&) | |
SetTemplateWeakPtr(uint32_t) override | |
SetUncheckedSymbol(int32_t, const System::String&) | Sets the symbol used to represent the unchecked state of a check box content control. |
StructuredDocumentTag(const System::SharedPtr<Aspose::Words::DocumentBase>&, Aspose::Words::Markup::SdtType, Aspose::Words::Markup::MarkupLevel) | Initializes a new instance of the Structured document tag class. |
ToString(Aspose::Words::SaveFormat) | Exports the content of the node into a string in the specified format. |
ToString(const System::SharedPtr<Aspose::Words::Saving::SaveOptions>&) | Exports the content of the node into a string using the specified save options. |
static Type() |
Remarks
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:
- Block-level - Among paragraphs and tables, as a child of a Body, HeaderFooter, Comment, Footnote or a Shape node.
- Row-level - Among rows in a table, as a child of a Table node.
- Cell-level - Among cells in a table row, as a child of a Row node.
- Inline-level - Among inline content inside, as a child of a Paragraph.
- Nested inside another StructuredDocumentTag.
Examples
Shows how to work with styles for content control elements.
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Below are two ways to apply a style from the document to a structured document tag.
// 1 - Apply a style object from the document's style collection:
SharedPtr<Style> quoteStyle = doc->get_Styles()->idx_get(StyleIdentifier::Quote);
auto sdtPlainText = MakeObject<StructuredDocumentTag>(doc, SdtType::PlainText, MarkupLevel::Inline);
sdtPlainText->set_Style(quoteStyle);
// 2 - Reference a style in the document by name:
auto sdtRichText = MakeObject<StructuredDocumentTag>(doc, SdtType::RichText, MarkupLevel::Inline);
sdtRichText->set_StyleName(u"Quote");
builder->InsertNode(sdtPlainText);
builder->InsertNode(sdtRichText);
ASSERT_EQ(NodeType::StructuredDocumentTag, sdtPlainText->get_NodeType());
SharedPtr<NodeCollection> tags = doc->GetChildNodes(NodeType::StructuredDocumentTag, true);
for (const auto& node : System::IterateOver(tags))
{
auto sdt = System::ExplicitCast<StructuredDocumentTag>(node);
ASSERT_EQ(StyleIdentifier::Quote, sdt->get_Style()->get_StyleIdentifier());
ASSERT_EQ(u"Quote", sdt->get_StyleName());
}
See Also
- Class CompositeNode
- Interface IStructuredDocumentTag
- Namespace Aspose::Words::Markup
- Library Aspose.Words for C++