Aspose::Words::Markup::StructuredDocumentTag Class Reference

Detailed Description

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:

Examples

Shows how to work with styles for content control elements.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Get specific style from the document to apply it to an SDT
SharedPtr<Style> quoteStyle = doc->get_Styles()->idx_get(Aspose::Words::StyleIdentifier::Quote);
auto sdtPlainText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::PlainText, Aspose::Words::Markup::MarkupLevel::Inline);
sdtPlainText->set_Style(quoteStyle);
auto sdtRichText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::RichText, Aspose::Words::Markup::MarkupLevel::Inline);
// Second method to apply specific style to an SDT control
sdtRichText->set_StyleName(u"Quote");
// Insert content controls into the document
builder->InsertNode(sdtPlainText);
builder->InsertNode(sdtRichText);
// We can get a collection of StructuredDocumentTags by looking for the document's child nodes of this NodeType
ASSERT_EQ(Aspose::Words::NodeType::StructuredDocumentTag, sdtPlainText->get_NodeType());
SharedPtr<NodeCollection> tags = doc->GetChildNodes(Aspose::Words::NodeType::StructuredDocumentTag, true);
for (auto node : System::IterateOver(tags))
{
auto sdt = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(node);
// If style was not defined before, style should be "Default Paragraph Font"
ASSERT_EQ(Aspose::Words::StyleIdentifier::Quote, sdt->get_Style()->get_StyleIdentifier());
ASSERT_EQ(u"Quote", sdt->get_StyleName());
}

#include <Aspose.Words.Cpp/Model/Markup/Sdt/StructuredDocumentTag.h>

+ Inheritance diagram for Aspose::Words::Markup::StructuredDocumentTag:

Public Member Functions

 StructuredDocumentTag (SharedPtr< DocumentBase > doc, SdtType type, MarkupLevel level)
 Initializes a new instance of the Structured document tag class. More...
 
bool Accept (SharedPtr< DocumentVisitor > visitor) override
 Accepts a visitor. More...
 
void Clear ()
 Clears contents of this structured document tag and displays a placeholder if it is defined. More...
 
String get_BuildingBlockCategory ()
 Specifies category of building block for this SDT node. Can not be null. More...
 
String get_BuildingBlockGallery ()
 Specifies type of building block for this SDT. Can not be null. More...
 
SdtCalendarType get_CalendarType ()
 Specifies the type of calendar for this SDT. Default is Default More...
 
bool get_Checked ()
 Gets/Sets current state of the Checkbox SDT. Default value for this property is false. More...
 
Color get_Color ()
 Gets or sets the color of the structured document tag. More...
 
SharedPtr< Fontget_ContentsFont ()
 Font formatting that will be applied to text entered into SDT. More...
 
String get_DateDisplayFormat ()
 String that represents the format in which dates are displayed. Can not be null. More...
 
int32_t get_DateDisplayLocale ()
 Allows to set/get the language format for the date displayed in this SDT. More...
 
SdtDateStorageFormat 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 More...
 
SharedPtr< Fontget_EndCharacterFont ()
 Font formatting that will be applied to the last character of text entered into SDT. More...
 
DateTime get_FullDate ()
 Specifies the full date and time last entered into this SDT. More...
 
int32_t get_Id ()
 Specifies a unique read-only persistent numerical Id for this SDT. More...
 
bool get_IsShowingPlaceholderText () const
 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. More...
 
bool get_IsTemporary () const
 Specifies whether this SDT shall be removed from the WordPprocessingML document when its contents are modified. More...
 
MarkupLevel get_Level () const
 Gets the level at which this SDT occurs in the document tree. More...
 
MarkupLevel get_Level_IMarkupNode () override
 
SharedPtr< SdtListItemCollectionget_ListItems ()
 Gets SdtListItemCollection associated with this SDT. More...
 
bool get_LockContentControl () const
 When set to true, this property will prohibit a user from deleting this SDT. More...
 
bool get_LockContents () const
 When set to true, this property will prohibit a user from editing the contents of this SDT. More...
 
bool get_Multiline ()
 Specifies whether this SDT allows multiple lines of text. More...
 
NodeType get_NodeType () const override
 Returns NodeType.StructuredDocumentTag. More...
 
SharedPtr< BuildingBlockget_Placeholder () const
 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. More...
 
String get_PlaceholderName () const
 Gets or sets Name of the BuildingBlock containing placeholder text. BuildingBlock with this name Name has to be present in the GlossaryDocument otherwise InvalidOperationException will occur. More...
 
SdtType get_SdtType ()
 Gets type of this Structured document tag. More...
 
SharedPtr< Styleget_Style ()
 Gets or sets the Style of the structured document tag. More...
 
String get_StyleName ()
 Gets or sets the name of the style applied to the structured document tag. More...
 
String get_Tag () const
 Specifies a tag associated with the current SDT node. Can not be null. More...
 
String get_Title () const
 Specifies the friendly name associated with this SDT. Can not be null. More...
 
SharedPtr< XmlMappingget_XmlMapping () const
 Gets an object that represents the mapping of this structured document tag to XML data in a custom XML part of the current document. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void RemoveSelfOnly ()
 Removes just this SDT node itself, but keeps the content of it inside the document tree. More...
 
void set_BuildingBlockCategory (String value)
 Setter for get_BuildingBlockCategory. More...
 
void set_BuildingBlockGallery (String value)
 Setter for get_BuildingBlockGallery. More...
 
void set_CalendarType (SdtCalendarType value)
 Setter for get_CalendarType. More...
 
void set_Checked (bool value)
 Setter for get_Checked. More...
 
void set_Color (Color value)
 Setter for get_Color. More...
 
void set_DateDisplayFormat (String value)
 Setter for get_DateDisplayFormat. More...
 
void set_DateDisplayLocale (int32_t value)
 Setter for get_DateDisplayLocale. More...
 
void set_DateStorageFormat (SdtDateStorageFormat value)
 Setter for get_DateStorageFormat. More...
 
void set_FullDate (DateTime value)
 Setter for get_FullDate. More...
 
void set_IsShowingPlaceholderText (bool value)
 Setter for get_IsShowingPlaceholderText. More...
 
void set_IsTemporary (bool value)
 Setter for get_IsTemporary. More...
 
void set_LockContentControl (bool value)
 Setter for get_LockContentControl. More...
 
void set_LockContents (bool value)
 Setter for get_LockContents. More...
 
void set_Multiline (bool value)
 Setter for get_Multiline. More...
 
void set_PlaceholderName (String value)
 Setter for get_PlaceholderName. More...
 
void set_Style (SharedPtr< Style > value)
 Setter for get_Style. More...
 
void set_StyleName (String value)
 Setter for get_StyleName. More...
 
void set_Tag (String value)
 Setter for get_Tag. More...
 
void set_Title (String value)
 Setter for get_Title. More...
 
- Public Member Functions inherited from CompositeNode
SharedPtr< NodeAppendChild (SharedPtr< Node > newChild)
 Adds the specified node to the end of the list of child nodes for this node. More...
 
SharedPtr< NodeCollectionget_ChildNodes ()
 Gets all immediate child nodes of this node. More...
 
SharedPtr< CompositeNodeget_Container () override
 
int32_t get_Count ()
 Gets the number of immediate children of this node. More...
 
SharedPtr< Nodeget_FirstChild () const
 Gets the first child of the node. More...
 
bool get_HasChildNodes ()
 Returns true if this node has any child nodes. More...
 
bool get_IsComposite () override
 Returns true as this node can have child nodes. More...
 
SharedPtr< Nodeget_LastChild () const
 Gets the last child of the node. More...
 
SharedPtr< NodeGetChild (NodeType nodeType, int32_t index, bool isDeep)
 Returns an Nth child node that matches the specified type. More...
 
SharedPtr< NodeCollectionGetChildNodes (NodeType nodeType, bool isDeep)
 Returns a live collection of child nodes that match the specified type. More...
 
SharedPtr< NodeGetCurrentNode () override
 
SharedPtr< IEnumerator< SharedPtr< Node > > > GetEnumerator () override
 Provides support for the for each style iteration over the child nodes of this node. More...
 
SharedPtr< NodeGetNextMatchingNode (SharedPtr< Node > curNode) override
 
String GetText () override
 Gets the text of this node and of all its children. More...
 
int32_t IndexOf (SharedPtr< Node > child)
 Returns the index of the specified child node in the child node array. More...
 
SharedPtr< NodeInsertAfter (SharedPtr< Node > newChild, SharedPtr< Node > refChild)
 Inserts the specified node immediately after the specified reference node. More...
 
SharedPtr< NodeInsertBefore (SharedPtr< Node > newChild, SharedPtr< Node > refChild)
 Inserts the specified node immediately before the specified reference node. More...
 
SharedPtr< NodePrependChild (SharedPtr< Node > newChild)
 Adds the specified node to the beginning of the list of child nodes for this node. More...
 
void RemoveAllChildren ()
 Removes all the child nodes of the current node. More...
 
SharedPtr< NodeRemoveChild (SharedPtr< Node > oldChild)
 Removes the specified child node. More...
 
void RemoveSmartTags ()
 Removes all SmartTag descendant nodes of the current node. More...
 
SharedPtr< NodeListSelectNodes (String xpath)
 Selects a list of nodes matching the XPath expression. More...
 
SharedPtr< NodeSelectSingleNode (String xpath)
 Selects the first Node that matches the XPath expression. More...
 
- Public Member Functions inherited from Node
SharedPtr< NodeClone (bool isCloneChildren)
 Creates a duplicate of the node. More...
 
virtual SharedPtr< DocumentBaseget_Document () const
 Gets the document to which this node belongs. More...
 
SharedPtr< Nodeget_NextSibling ()
 Gets the node immediately following this node. More...
 
SharedPtr< CompositeNodeget_ParentNode ()
 Gets the immediate parent of this node. More...
 
SharedPtr< Nodeget_PreviousSibling ()
 Gets the node immediately preceding this node. More...
 
SharedPtr< Rangeget_Range ()
 Returns a Range object that represents the portion of a document that is contained in this node. More...
 
SharedPtr< CompositeNodeGetAncestor (NodeType ancestorType)
 Gets the first ancestor of the specified NodeType. More...
 
template<typename T >
GetAncestorOf ()
 
SharedPtr< NodeNextPreOrder (SharedPtr< Node > rootNode)
 Gets next node according to the pre-order tree traversal algorithm. More...
 
SharedPtr< NodePreviousPreOrder (SharedPtr< Node > rootNode)
 Gets the previous node according to the pre-order tree traversal algorithm. More...
 
void Remove ()
 Removes itself from the parent. More...
 
String ToString (SaveFormat saveFormat)
 Exports the content of the node into a string in the specified format. More...
 
String ToString (SharedPtr< SaveOptions > saveOptions)
 Exports the content of the node into a string using the specified save options. More...
 
- Public Member Functions inherited from Object
ASPOSECPP_SHARED_API Object ()
 
ASPOSECPP_SHARED_API Object (Object const &x)
 
virtual ASPOSECPP_SHARED_API ~Object ()
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 
Detail::SmartPtrCounter * GetCounter ()
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 
ASPOSECPP_SHARED_API void Lock ()
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 
Objectoperator= (Object const &x)
 
bool ReferenceEquals (String const &str, std::nullptr_t)
 
bool ReferenceEquals (String const &str1, String const &str2)
 
int RemovedSharedRefs (int count)
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (unsigned int argument)
 
int SharedCount () const
 
ObjectSharedRefAdded ()
 
int SharedRefRemovedSafe ()
 
virtual ASPOSECPP_SHARED_API String ToString () const
 
ASPOSECPP_SHARED_API void Unlock ()
 
Detail::SmartPtrCounter * WeakRefAdded ()
 
void WeakRefRemoved ()
 
- Public Member Functions inherited from System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Node > >
EnumeratorBasedIterator< T, IEnumerator< T > > begin () noexcept
 
EnumeratorBasedIterator< T, IEnumerator< T > > cbegin () noexcept
 
EnumeratorBasedIterator< T, IEnumerator< T > > cend () noexcept
 
EnumeratorBasedIterator< T, IEnumerator< T > > end () noexcept
 
bool LINQ_All (std::function< bool(T)> predicate)
 
bool LINQ_Any ()
 
bool LINQ_Any (std::function< bool(T)> predicate)
 
SharedPtr< IEnumerable< ResultType > > LINQ_Cast ()
 
SharedPtr< IEnumerable< Result > > LINQ_Cast ()
 
bool LINQ_Contains (T value)
 
int LINQ_Count ()
 
int LINQ_Count (const Func< T, bool > &predicate)
 
LINQ_ElementAt (int index)
 
LINQ_First ()
 
LINQ_First (const Func< T, bool > &predicate)
 
LINQ_FirstOrDefault ()
 
LINQ_FirstOrDefault (std::function< bool(T)> predicate)
 
LINQ_Last ()
 
LINQ_LastOrDefault ()
 
SharedPtr< IEnumerable< ResultType > > LINQ_OfType ()
 
SharedPtr< IEnumerable< Result > > LINQ_OfType ()
 
SharedPtr< IEnumerable< Source > > LINQ_OrderBy (const Func< Source, Key > &keySelector)
 
SharedPtr< IEnumerable< T > > LINQ_OrderBy (const Func< T, Key > &keySelector)
 
SharedPtr< IEnumerable< Result > > LINQ_Select (const Func< Source, Result > &selector)
 
SharedPtr< IEnumerable< ResultType > > LINQ_Select (const Func< T, ResultType > &selector)
 
ArrayPtr< T > LINQ_ToArray ()
 
SharedPtr< List< T > > LINQ_ToList ()
 
SharedPtr< IEnumerable< T > > LINQ_Where (std::function< bool(T)> predicate)
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from CompositeNode
static const TypeInfoType ()
 
- Static Public Member Functions inherited from Node
static String NodeTypeToString (NodeType nodeType)
 A utility method that converts a node type enum value into a user friendly string. More...
 
static const TypeInfoType ()
 
- Static Public Member Functions inherited from Object
bool Equals (double const &objA, double const &objB)
 
bool Equals (float const &objA, float const &objB)
 
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 
static const TypeInfoType ()
 

Additional Inherited Members

- Public Types inherited from Object
typedef SmartPtr< Objectptr
 
typedef System::Details::SharedMembersType shared_members_type
 
- Public Types inherited from System::Collections::Generic::IEnumerable< System::SharedPtr< Aspose::Words::Node > >
typedef IEnumerator< T > IEnumeratorType
 
typedef T ValueType
 

Constructor & Destructor Documentation

◆ StructuredDocumentTag()

Aspose::Words::Markup::StructuredDocumentTag::StructuredDocumentTag ( System::SharedPtr< Aspose::Words::DocumentBase doc,
Aspose::Words::Markup::SdtType  type,
Aspose::Words::Markup::MarkupLevel  level 
)

Initializes a new instance of the Structured document tag class.

The following types of SDT can be created:

Parameters
docThe owner document.
typeType of SDT node.
levelLevel of SDT node within the document.
Examples

Show how to create and insert checkbox structured document tag.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto sdtCheckBox = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::Checkbox, Aspose::Words::Markup::MarkupLevel::Inline);
sdtCheckBox->set_Checked(true);
// Insert content control into the document
builder->InsertNode(sdtCheckBox);

Member Function Documentation

◆ Accept()

bool Aspose::Words::Markup::StructuredDocumentTag::Accept ( System::SharedPtr< Aspose::Words::DocumentVisitor visitor)
overridevirtual

Accepts a visitor.

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.

Parameters
visitorThe visitor that will visit the nodes.
Returns
True if all nodes were visited; false if DocumentVisitor stopped the operation before visiting all nodes.

Implements Aspose::Words::Node.

◆ Clear()

void Aspose::Words::Markup::StructuredDocumentTag::Clear ( )

Clears contents of this structured document tag and displays a placeholder if it is defined.

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 XmlMapping property), the referenced XML node is cleared.

Examples

Shows how to delete content of StructuredDocumentTag elements.

auto doc = MakeObject<Document>();
// Create a plain text structured document tag and append it to the document
doc->get_FirstSection()->get_Body()->AppendChild(tag);
// This structured document tag, which is in the form of a text box, already displays placeholder text
ASSERT_EQ(u"Click here to enter text.", tag->GetText().Trim());
ASSERT_TRUE(tag->get_IsShowingPlaceholderText());
// Create a building block that
SharedPtr<GlossaryDocument> glossaryDoc = doc->get_GlossaryDocument();
auto substituteBlock = MakeObject<BuildingBlock>(glossaryDoc);
substituteBlock->set_Name(u"My placeholder");
substituteBlock->AppendChild(MakeObject<Section>(glossaryDoc));
substituteBlock->get_FirstSection()->EnsureMinimum();
substituteBlock->get_FirstSection()->get_Body()->get_FirstParagraph()->AppendChild(MakeObject<Run>(glossaryDoc, u"Custom placeholder text."));
glossaryDoc->AppendChild(substituteBlock);
// Set the tag's placeholder to the building block
tag->set_PlaceholderName(u"My placeholder");
ASSERT_EQ(u"Custom placeholder text.", tag->GetText().Trim());
ASSERT_TRUE(tag->get_IsShowingPlaceholderText());
// Edit the text of the structured document tag and disable showing of placeholder text
auto run = System::DynamicCast<Aspose::Words::Run>(tag->GetChild(Aspose::Words::NodeType::Run, 0, true));
run->set_Text(u"New text.");
tag->set_IsShowingPlaceholderText(false);
ASSERT_EQ(u"New text.", tag->GetText().Trim());
tag->Clear();
// Clearing a PlainText tag reverts these changes
ASSERT_TRUE(tag->get_IsShowingPlaceholderText());
ASSERT_EQ(u"Custom placeholder text.", tag->GetText().Trim());

◆ get_BuildingBlockCategory()

System::String Aspose::Words::Markup::StructuredDocumentTag::get_BuildingBlockCategory ( )

Specifies category of building block for this SDT node. Can not be null.

Accessing this property will only work for BuildingBlockGallery and DocPartObj SDT types. It is read-only for SDT of the document part type.

For all other SDT types exception will occur.

Examples

Shows how to insert a StructuredDocumentTag as a building block and set its category and gallery.

auto doc = MakeObject<Document>();
auto buildingBlockSdt = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::BuildingBlockGallery, Aspose::Words::Markup::MarkupLevel::Block);
buildingBlockSdt->set_BuildingBlockCategory(u"Built-in");
buildingBlockSdt->set_BuildingBlockGallery(u"Table of Contents");
doc->get_FirstSection()->get_Body()->AppendChild(buildingBlockSdt);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.BuildingBlockCategories.docx");

◆ get_BuildingBlockGallery()

System::String Aspose::Words::Markup::StructuredDocumentTag::get_BuildingBlockGallery ( )

Specifies type of building block for this SDT. Can not be null.

Accessing this property will only work for BuildingBlockGallery and DocPartObj SDT types. It is read-only for SDT of the document part type.

For all other SDT types exception will occur.

Examples

Shows how to insert a StructuredDocumentTag as a building block and set its category and gallery.

auto doc = MakeObject<Document>();
auto buildingBlockSdt = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::BuildingBlockGallery, Aspose::Words::Markup::MarkupLevel::Block);
buildingBlockSdt->set_BuildingBlockCategory(u"Built-in");
buildingBlockSdt->set_BuildingBlockGallery(u"Table of Contents");
doc->get_FirstSection()->get_Body()->AppendChild(buildingBlockSdt);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.BuildingBlockCategories.docx");

◆ get_CalendarType()

Aspose::Words::Markup::SdtCalendarType Aspose::Words::Markup::StructuredDocumentTag::get_CalendarType ( )

Specifies the type of calendar for this SDT. Default is Default

Accessing this property will only work for Date SDT type.

For all other SDT types exception will occur.

Examples

Shows how to prompt the user to enter a date with a StructuredDocumentTag.

// Create a new document
auto doc = MakeObject<Document>();
// Insert a StructuredDocumentTag that prompts the user to enter a date
// In Microsoft Word, this element is known as a "Date picker content control"
// When we click on the arrow on the right end of this tag in Microsoft Word,
// we will see a pop up in the form of a clickable calendar
// We can use that popup to select a date that will be displayed by the tag
auto sdtDate = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::Date, Aspose::Words::Markup::MarkupLevel::Inline);
// This attribute sets the language that the calendar will be displayed in,
// which in this case will be Saudi Arabian Arabic
sdtDate->set_DateDisplayLocale(System::Globalization::CultureInfo::GetCultureInfo(u"ar-SA")->get_LCID());
// We can set the format with which to display the date like this
// The locale we set above will be carried over to the displayed date
sdtDate->set_DateDisplayFormat(u"dd MMMM, yyyy");
// Select how the data will be stored in the document
// Set the calendar type that will be used to select and display the date
// Before a date is chosen, the tag will display the text "Click here to enter a date."
// We can set a default date to display by setting this variable
// We must convert the date to the appropriate calendar ourselves
sdtDate->set_FullDate(System::DateTime(1440, 10, 20));
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(sdtDate);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.Date.docx");

◆ get_Checked()

bool Aspose::Words::Markup::StructuredDocumentTag::get_Checked ( )

Gets/Sets current state of the Checkbox SDT. Default value for this property is false.

Accessing this property will only work for Checkbox SDT types.

For all other SDT types exception will occur.

Examples

Show how to create and insert checkbox structured document tag.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto sdtCheckBox = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::Checkbox, Aspose::Words::Markup::MarkupLevel::Inline);
sdtCheckBox->set_Checked(true);
// Insert content control into the document
builder->InsertNode(sdtCheckBox);

◆ get_Color()

System::Drawing::Color Aspose::Words::Markup::StructuredDocumentTag::get_Color ( )

Gets or sets the color of the structured document tag.

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_ContentsFont()

System::SharedPtr<Aspose::Words::Font> Aspose::Words::Markup::StructuredDocumentTag::get_ContentsFont ( )

Font formatting that will be applied to text entered into SDT.

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_DateDisplayFormat()

System::String Aspose::Words::Markup::StructuredDocumentTag::get_DateDisplayFormat ( )

String that represents the format in which dates are displayed. Can not be null.

Accessing this property will only work for Date SDT type.

For all other SDT types exception will occur.

Examples

Shows how to prompt the user to enter a date with a StructuredDocumentTag.

// Create a new document
auto doc = MakeObject<Document>();
// Insert a StructuredDocumentTag that prompts the user to enter a date
// In Microsoft Word, this element is known as a "Date picker content control"
// When we click on the arrow on the right end of this tag in Microsoft Word,
// we will see a pop up in the form of a clickable calendar
// We can use that popup to select a date that will be displayed by the tag
auto sdtDate = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::Date, Aspose::Words::Markup::MarkupLevel::Inline);
// This attribute sets the language that the calendar will be displayed in,
// which in this case will be Saudi Arabian Arabic
sdtDate->set_DateDisplayLocale(System::Globalization::CultureInfo::GetCultureInfo(u"ar-SA")->get_LCID());
// We can set the format with which to display the date like this
// The locale we set above will be carried over to the displayed date
sdtDate->set_DateDisplayFormat(u"dd MMMM, yyyy");
// Select how the data will be stored in the document
// Set the calendar type that will be used to select and display the date
// Before a date is chosen, the tag will display the text "Click here to enter a date."
// We can set a default date to display by setting this variable
// We must convert the date to the appropriate calendar ourselves
sdtDate->set_FullDate(System::DateTime(1440, 10, 20));
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(sdtDate);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.Date.docx");

◆ get_DateDisplayLocale()

int32_t Aspose::Words::Markup::StructuredDocumentTag::get_DateDisplayLocale ( )

Allows to set/get the language format for the date displayed in this SDT.

Accessing this property will only work for Date SDT type.

For all other SDT types exception will occur.

Examples

Shows how to prompt the user to enter a date with a StructuredDocumentTag.

// Create a new document
auto doc = MakeObject<Document>();
// Insert a StructuredDocumentTag that prompts the user to enter a date
// In Microsoft Word, this element is known as a "Date picker content control"
// When we click on the arrow on the right end of this tag in Microsoft Word,
// we will see a pop up in the form of a clickable calendar
// We can use that popup to select a date that will be displayed by the tag
auto sdtDate = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::Date, Aspose::Words::Markup::MarkupLevel::Inline);
// This attribute sets the language that the calendar will be displayed in,
// which in this case will be Saudi Arabian Arabic
sdtDate->set_DateDisplayLocale(System::Globalization::CultureInfo::GetCultureInfo(u"ar-SA")->get_LCID());
// We can set the format with which to display the date like this
// The locale we set above will be carried over to the displayed date
sdtDate->set_DateDisplayFormat(u"dd MMMM, yyyy");
// Select how the data will be stored in the document
// Set the calendar type that will be used to select and display the date
// Before a date is chosen, the tag will display the text "Click here to enter a date."
// We can set a default date to display by setting this variable
// We must convert the date to the appropriate calendar ourselves
sdtDate->set_FullDate(System::DateTime(1440, 10, 20));
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(sdtDate);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.Date.docx");

◆ get_DateStorageFormat()

Aspose::Words::Markup::SdtDateStorageFormat Aspose::Words::Markup::StructuredDocumentTag::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

Accessing this property will only work for Date SDT type.

For all other SDT types exception will occur.

Examples

Shows how to prompt the user to enter a date with a StructuredDocumentTag.

// Create a new document
auto doc = MakeObject<Document>();
// Insert a StructuredDocumentTag that prompts the user to enter a date
// In Microsoft Word, this element is known as a "Date picker content control"
// When we click on the arrow on the right end of this tag in Microsoft Word,
// we will see a pop up in the form of a clickable calendar
// We can use that popup to select a date that will be displayed by the tag
auto sdtDate = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::Date, Aspose::Words::Markup::MarkupLevel::Inline);
// This attribute sets the language that the calendar will be displayed in,
// which in this case will be Saudi Arabian Arabic
sdtDate->set_DateDisplayLocale(System::Globalization::CultureInfo::GetCultureInfo(u"ar-SA")->get_LCID());
// We can set the format with which to display the date like this
// The locale we set above will be carried over to the displayed date
sdtDate->set_DateDisplayFormat(u"dd MMMM, yyyy");
// Select how the data will be stored in the document
// Set the calendar type that will be used to select and display the date
// Before a date is chosen, the tag will display the text "Click here to enter a date."
// We can set a default date to display by setting this variable
// We must convert the date to the appropriate calendar ourselves
sdtDate->set_FullDate(System::DateTime(1440, 10, 20));
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(sdtDate);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.Date.docx");

◆ get_EndCharacterFont()

System::SharedPtr<Aspose::Words::Font> Aspose::Words::Markup::StructuredDocumentTag::get_EndCharacterFont ( )

Font formatting that will be applied to the last character of text entered into SDT.

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_FullDate()

System::DateTime Aspose::Words::Markup::StructuredDocumentTag::get_FullDate ( )

Specifies the full date and time last entered into this SDT.

Accessing this property will only work for Date SDT type.

For all other SDT types exception will occur.

Examples

Shows how to prompt the user to enter a date with a StructuredDocumentTag.

// Create a new document
auto doc = MakeObject<Document>();
// Insert a StructuredDocumentTag that prompts the user to enter a date
// In Microsoft Word, this element is known as a "Date picker content control"
// When we click on the arrow on the right end of this tag in Microsoft Word,
// we will see a pop up in the form of a clickable calendar
// We can use that popup to select a date that will be displayed by the tag
auto sdtDate = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::Date, Aspose::Words::Markup::MarkupLevel::Inline);
// This attribute sets the language that the calendar will be displayed in,
// which in this case will be Saudi Arabian Arabic
sdtDate->set_DateDisplayLocale(System::Globalization::CultureInfo::GetCultureInfo(u"ar-SA")->get_LCID());
// We can set the format with which to display the date like this
// The locale we set above will be carried over to the displayed date
sdtDate->set_DateDisplayFormat(u"dd MMMM, yyyy");
// Select how the data will be stored in the document
// Set the calendar type that will be used to select and display the date
// Before a date is chosen, the tag will display the text "Click here to enter a date."
// We can set a default date to display by setting this variable
// We must convert the date to the appropriate calendar ourselves
sdtDate->set_FullDate(System::DateTime(1440, 10, 20));
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(sdtDate);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.Date.docx");

◆ get_Id()

int32_t Aspose::Words::Markup::StructuredDocumentTag::get_Id ( )

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

Id attribute shall follow these rules:

  • The document shall retain SDT ids only if the whole document is cloned Clone.
  • During ImportNode() 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 standalone SDT Clone() 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.
Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_IsShowingPlaceholderText()

bool Aspose::Words::Markup::StructuredDocumentTag::get_IsShowingPlaceholderText ( ) const

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.

Examples

Shows how to use the contents of a BuildingBlock as a custom placeholder text for a StructuredDocumentTag.

auto doc = MakeObject<Document>();
// Insert a plain text StructuredDocumentTag of the PlainText type, which will function like a text box
// It contains a default "Click here to enter text." prompt, which we can click and replace with our own text
// We can substitute that default placeholder with a custom phrase, which will be drawn from a BuildingBlock
// First we will need to create the BuildingBlock, give it content and add it to the GlossaryDocument
SharedPtr<GlossaryDocument> glossaryDoc = doc->get_GlossaryDocument();
auto substituteBlock = MakeObject<BuildingBlock>(glossaryDoc);
substituteBlock->set_Name(u"Custom Placeholder");
substituteBlock->AppendChild(MakeObject<Section>(glossaryDoc));
substituteBlock->get_FirstSection()->AppendChild(MakeObject<Body>(glossaryDoc));
substituteBlock->get_FirstSection()->get_Body()->AppendParagraph(u"Custom placeholder text.");
glossaryDoc->AppendChild(substituteBlock);
// The substitute BuildingBlock we made can be referenced by name
tag->set_PlaceholderName(u"Custom Placeholder");
// If PlaceholderName refers to an existing block in the parent document's GlossaryDocument,
// the BuildingBlock will be automatically found and assigned to the Placeholder attribute
ASPOSE_ASSERT_EQ(substituteBlock, tag->get_Placeholder());
// Setting this to true will register the text inside the StructuredDocumentTag as placeholder text
// This means that, in Microsoft Word, all the text contents of the StructuredDocumentTag will be highlighted with one click,
// so we can immediately replace the entire substitute text by typing
// If this is false, the text will behave like an ordinary Paragraph and a cursor will be placed with nothing highlighted
tag->set_IsShowingPlaceholderText(true);
// Insert the StructuredDocumentTag into the document using a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlaceholderBuildingBlock.docx");

◆ get_IsTemporary()

bool Aspose::Words::Markup::StructuredDocumentTag::get_IsTemporary ( ) const

Specifies whether this SDT shall be removed from the WordPprocessingML document when its contents are modified.

Examples

Demonstrates the effects of making a StructuredDocumentTag temporary.

auto doc = MakeObject<Document>();
// Insert a plain text StructuredDocumentTag, which will prompt the user to enter text
// and allow them to edit it like a text box
// If we set its Temporary attribute to true, as soon as we start typing,
// the tag will disappear and its contents will be assimilated into the parent Paragraph
tag->set_IsTemporary(true);
// Insert the StructuredDocumentTag with a DocumentBuilder
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Write(u"Temporary text box: ");
builder->InsertNode(tag);
// A StructuredDocumentTag in the form of a check box will let the user a square to check and uncheck
// Setting it to temporary will freeze its value after the first time it is clicked
tag->set_IsTemporary(true);
builder->Write(u"\nTemporary checkbox: ");
builder->InsertNode(tag);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.IsTemporary.docx");

◆ get_Level()

Aspose::Words::Markup::MarkupLevel Aspose::Words::Markup::StructuredDocumentTag::get_Level ( ) const

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

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_Level_IMarkupNode()

Aspose::Words::Markup::MarkupLevel Aspose::Words::Markup::StructuredDocumentTag::get_Level_IMarkupNode ( )
override

◆ get_ListItems()

System::SharedPtr<Aspose::Words::Markup::SdtListItemCollection> Aspose::Words::Markup::StructuredDocumentTag::get_ListItems ( )

Gets SdtListItemCollection associated with this SDT.

Accessing this property will only work for ComboBox or DropDownList SDT types.

For all other SDT types exception will occur.

Examples

Shows how to work with StructuredDocumentTag nodes of the DropDownList type.

// Create a blank document and insert a StructuredDocumentTag that will contain a drop down list
auto doc = MakeObject<Document>();
doc->get_FirstSection()->get_Body()->AppendChild(tag);
// A drop down list needs elements, each of which will be a SdtListItem
SharedPtr<SdtListItemCollection> listItems = tag->get_ListItems();
listItems->Add(MakeObject<SdtListItem>(u"Value 1"));
// Each SdtListItem has text that will be displayed when the drop down list is opened, and also a value
// When we initialize with one string, we are providing just the value
// Accordingly, value is passed as DisplayText and will consequently be displayed on the screen
ASSERT_EQ(listItems->idx_get(0)->get_DisplayText(), listItems->idx_get(0)->get_Value());
// Add 3 more SdtListItems with non-empty strings passed to DisplayText
listItems->Add(MakeObject<SdtListItem>(u"Item 2", u"Value 2"));
listItems->Add(MakeObject<SdtListItem>(u"Item 3", u"Value 3"));
listItems->Add(MakeObject<SdtListItem>(u"Item 4", u"Value 4"));
// We can obtain a count of the SdtListItems and also set the drop down list's SelectedValue attribute to
// automatically have one of them pre-selected when we open the document in Microsoft Word
ASSERT_EQ(4, listItems->get_Count());
listItems->set_SelectedValue(listItems->idx_get(3));
ASSERT_EQ(u"Value 4", listItems->get_SelectedValue()->get_Value());
// We can enumerate over the collection and print each element
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<SdtListItem>>> enumerator = listItems->GetEnumerator();
while (enumerator->MoveNext())
{
if (enumerator->get_Current() != nullptr)
{
System::Console::WriteLine(String::Format(u"List item: {0}, value: {1}",enumerator->get_Current()->get_DisplayText(),enumerator->get_Current()->get_Value()));
}
}
}
// We can also remove elements one at a time
listItems->RemoveAt(3);
ASSERT_EQ(3, listItems->get_Count());
// Make sure to update the SelectedValue's index if it ever ends up out of bounds before saving the document
listItems->set_SelectedValue(listItems->idx_get(1));
doc->Save(ArtifactsDir + u"StructuredDocumentTag.ListItemCollection.docx");
// We can clear the whole collection at once too
listItems->Clear();
ASSERT_EQ(0, listItems->get_Count());

◆ get_LockContentControl()

bool Aspose::Words::Markup::StructuredDocumentTag::get_LockContentControl ( ) const

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

Examples

Shows how to restrict the editing of a StructuredDocumentTag.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert a plain text StructuredDocumentTag of the PlainText type, which will function like a text box
// It contains a default "Click here to enter text." prompt, which we can click and replace with our own text
// We can prohibit the users from editing the inner text in Microsoft Word by setting this to true
tag->set_LockContents(true);
builder->Write(u"The contents of this StructuredDocumentTag cannot be edited: ");
builder->InsertNode(tag);
// Setting this to true will disable the deletion of this StructuredDocumentTag
// by text editing operations in Microsoft Word
tag->set_LockContentControl(true);
builder->InsertParagraph();
builder->Write(u"This StructuredDocumentTag cannot be deleted but its contents can be edited: ");
builder->InsertNode(tag);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.Lock.docx");

◆ get_LockContents()

bool Aspose::Words::Markup::StructuredDocumentTag::get_LockContents ( ) const

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

Examples

Shows how to restrict the editing of a StructuredDocumentTag.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Insert a plain text StructuredDocumentTag of the PlainText type, which will function like a text box
// It contains a default "Click here to enter text." prompt, which we can click and replace with our own text
// We can prohibit the users from editing the inner text in Microsoft Word by setting this to true
tag->set_LockContents(true);
builder->Write(u"The contents of this StructuredDocumentTag cannot be edited: ");
builder->InsertNode(tag);
// Setting this to true will disable the deletion of this StructuredDocumentTag
// by text editing operations in Microsoft Word
tag->set_LockContentControl(true);
builder->InsertParagraph();
builder->Write(u"This StructuredDocumentTag cannot be deleted but its contents can be edited: ");
builder->InsertNode(tag);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.Lock.docx");

◆ get_Multiline()

bool Aspose::Words::Markup::StructuredDocumentTag::get_Multiline ( )

Specifies whether this SDT allows multiple lines of text.

Accessing this property will only work for RichText and PlainText SDT type.

For all other SDT types exception will occur.

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_NodeType()

Aspose::Words::NodeType Aspose::Words::Markup::StructuredDocumentTag::get_NodeType ( ) const
overridevirtual

Returns NodeType.StructuredDocumentTag.

Examples

Shows how to work with styles for content control elements.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Get specific style from the document to apply it to an SDT
SharedPtr<Style> quoteStyle = doc->get_Styles()->idx_get(Aspose::Words::StyleIdentifier::Quote);
auto sdtPlainText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::PlainText, Aspose::Words::Markup::MarkupLevel::Inline);
sdtPlainText->set_Style(quoteStyle);
auto sdtRichText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::RichText, Aspose::Words::Markup::MarkupLevel::Inline);
// Second method to apply specific style to an SDT control
sdtRichText->set_StyleName(u"Quote");
// Insert content controls into the document
builder->InsertNode(sdtPlainText);
builder->InsertNode(sdtRichText);
// We can get a collection of StructuredDocumentTags by looking for the document's child nodes of this NodeType
ASSERT_EQ(Aspose::Words::NodeType::StructuredDocumentTag, sdtPlainText->get_NodeType());
SharedPtr<NodeCollection> tags = doc->GetChildNodes(Aspose::Words::NodeType::StructuredDocumentTag, true);
for (auto node : System::IterateOver(tags))
{
auto sdt = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(node);
// If style was not defined before, style should be "Default Paragraph Font"
ASSERT_EQ(Aspose::Words::StyleIdentifier::Quote, sdt->get_Style()->get_StyleIdentifier());
ASSERT_EQ(u"Quote", sdt->get_StyleName());
}

Implements Aspose::Words::Node.

◆ get_Placeholder()

System::SharedPtr<Aspose::Words::BuildingBlocks::BuildingBlock> Aspose::Words::Markup::StructuredDocumentTag::get_Placeholder ( ) const

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.

Examples

Shows how to use the contents of a BuildingBlock as a custom placeholder text for a StructuredDocumentTag.

auto doc = MakeObject<Document>();
// Insert a plain text StructuredDocumentTag of the PlainText type, which will function like a text box
// It contains a default "Click here to enter text." prompt, which we can click and replace with our own text
// We can substitute that default placeholder with a custom phrase, which will be drawn from a BuildingBlock
// First we will need to create the BuildingBlock, give it content and add it to the GlossaryDocument
SharedPtr<GlossaryDocument> glossaryDoc = doc->get_GlossaryDocument();
auto substituteBlock = MakeObject<BuildingBlock>(glossaryDoc);
substituteBlock->set_Name(u"Custom Placeholder");
substituteBlock->AppendChild(MakeObject<Section>(glossaryDoc));
substituteBlock->get_FirstSection()->AppendChild(MakeObject<Body>(glossaryDoc));
substituteBlock->get_FirstSection()->get_Body()->AppendParagraph(u"Custom placeholder text.");
glossaryDoc->AppendChild(substituteBlock);
// The substitute BuildingBlock we made can be referenced by name
tag->set_PlaceholderName(u"Custom Placeholder");
// If PlaceholderName refers to an existing block in the parent document's GlossaryDocument,
// the BuildingBlock will be automatically found and assigned to the Placeholder attribute
ASPOSE_ASSERT_EQ(substituteBlock, tag->get_Placeholder());
// Setting this to true will register the text inside the StructuredDocumentTag as placeholder text
// This means that, in Microsoft Word, all the text contents of the StructuredDocumentTag will be highlighted with one click,
// so we can immediately replace the entire substitute text by typing
// If this is false, the text will behave like an ordinary Paragraph and a cursor will be placed with nothing highlighted
tag->set_IsShowingPlaceholderText(true);
// Insert the StructuredDocumentTag into the document using a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlaceholderBuildingBlock.docx");

◆ get_PlaceholderName()

System::String Aspose::Words::Markup::StructuredDocumentTag::get_PlaceholderName ( ) const

Gets or sets Name of the BuildingBlock containing placeholder text. BuildingBlock with this name Name has to be present in the GlossaryDocument otherwise InvalidOperationException will occur.

Examples

Shows how to use the contents of a BuildingBlock as a custom placeholder text for a StructuredDocumentTag.

auto doc = MakeObject<Document>();
// Insert a plain text StructuredDocumentTag of the PlainText type, which will function like a text box
// It contains a default "Click here to enter text." prompt, which we can click and replace with our own text
// We can substitute that default placeholder with a custom phrase, which will be drawn from a BuildingBlock
// First we will need to create the BuildingBlock, give it content and add it to the GlossaryDocument
SharedPtr<GlossaryDocument> glossaryDoc = doc->get_GlossaryDocument();
auto substituteBlock = MakeObject<BuildingBlock>(glossaryDoc);
substituteBlock->set_Name(u"Custom Placeholder");
substituteBlock->AppendChild(MakeObject<Section>(glossaryDoc));
substituteBlock->get_FirstSection()->AppendChild(MakeObject<Body>(glossaryDoc));
substituteBlock->get_FirstSection()->get_Body()->AppendParagraph(u"Custom placeholder text.");
glossaryDoc->AppendChild(substituteBlock);
// The substitute BuildingBlock we made can be referenced by name
tag->set_PlaceholderName(u"Custom Placeholder");
// If PlaceholderName refers to an existing block in the parent document's GlossaryDocument,
// the BuildingBlock will be automatically found and assigned to the Placeholder attribute
ASPOSE_ASSERT_EQ(substituteBlock, tag->get_Placeholder());
// Setting this to true will register the text inside the StructuredDocumentTag as placeholder text
// This means that, in Microsoft Word, all the text contents of the StructuredDocumentTag will be highlighted with one click,
// so we can immediately replace the entire substitute text by typing
// If this is false, the text will behave like an ordinary Paragraph and a cursor will be placed with nothing highlighted
tag->set_IsShowingPlaceholderText(true);
// Insert the StructuredDocumentTag into the document using a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlaceholderBuildingBlock.docx");

◆ get_SdtType()

Aspose::Words::Markup::SdtType Aspose::Words::Markup::StructuredDocumentTag::get_SdtType ( )

Gets type of this Structured document tag.

Examples

Shows how to get type of structured document tag.

auto doc = MakeObject<Document>(MyDir + u"Structured document tags.docx");
SharedPtr<System::Collections::Generic::List<SharedPtr<StructuredDocumentTag>>> sdTags = doc->GetChildNodes(Aspose::Words::NodeType::StructuredDocumentTag, true)->LINQ_OfType<SharedPtr<StructuredDocumentTag> >()->LINQ_ToList();
ASSERT_EQ(Aspose::Words::Markup::SdtType::RepeatingSection, sdTags->idx_get(0)->get_SdtType());
ASSERT_EQ(Aspose::Words::Markup::SdtType::RepeatingSectionItem, sdTags->idx_get(1)->get_SdtType());
ASSERT_EQ(Aspose::Words::Markup::SdtType::RichText, sdTags->idx_get(2)->get_SdtType());

◆ get_Style()

System::SharedPtr<Aspose::Words::Style> Aspose::Words::Markup::StructuredDocumentTag::get_Style ( )

Gets or sets the Style of the structured document tag.

Examples

Shows how to work with styles for content control elements.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Get specific style from the document to apply it to an SDT
SharedPtr<Style> quoteStyle = doc->get_Styles()->idx_get(Aspose::Words::StyleIdentifier::Quote);
auto sdtPlainText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::PlainText, Aspose::Words::Markup::MarkupLevel::Inline);
sdtPlainText->set_Style(quoteStyle);
auto sdtRichText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::RichText, Aspose::Words::Markup::MarkupLevel::Inline);
// Second method to apply specific style to an SDT control
sdtRichText->set_StyleName(u"Quote");
// Insert content controls into the document
builder->InsertNode(sdtPlainText);
builder->InsertNode(sdtRichText);
// We can get a collection of StructuredDocumentTags by looking for the document's child nodes of this NodeType
ASSERT_EQ(Aspose::Words::NodeType::StructuredDocumentTag, sdtPlainText->get_NodeType());
SharedPtr<NodeCollection> tags = doc->GetChildNodes(Aspose::Words::NodeType::StructuredDocumentTag, true);
for (auto node : System::IterateOver(tags))
{
auto sdt = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(node);
// If style was not defined before, style should be "Default Paragraph Font"
ASSERT_EQ(Aspose::Words::StyleIdentifier::Quote, sdt->get_Style()->get_StyleIdentifier());
ASSERT_EQ(u"Quote", sdt->get_StyleName());
}

◆ get_StyleName()

System::String Aspose::Words::Markup::StructuredDocumentTag::get_StyleName ( )

Gets or sets the name of the style applied to the structured document tag.

Examples

Shows how to work with styles for content control elements.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Get specific style from the document to apply it to an SDT
SharedPtr<Style> quoteStyle = doc->get_Styles()->idx_get(Aspose::Words::StyleIdentifier::Quote);
auto sdtPlainText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::PlainText, Aspose::Words::Markup::MarkupLevel::Inline);
sdtPlainText->set_Style(quoteStyle);
auto sdtRichText = MakeObject<StructuredDocumentTag>(doc, Aspose::Words::Markup::SdtType::RichText, Aspose::Words::Markup::MarkupLevel::Inline);
// Second method to apply specific style to an SDT control
sdtRichText->set_StyleName(u"Quote");
// Insert content controls into the document
builder->InsertNode(sdtPlainText);
builder->InsertNode(sdtRichText);
// We can get a collection of StructuredDocumentTags by looking for the document's child nodes of this NodeType
ASSERT_EQ(Aspose::Words::NodeType::StructuredDocumentTag, sdtPlainText->get_NodeType());
SharedPtr<NodeCollection> tags = doc->GetChildNodes(Aspose::Words::NodeType::StructuredDocumentTag, true);
for (auto node : System::IterateOver(tags))
{
auto sdt = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(node);
// If style was not defined before, style should be "Default Paragraph Font"
ASSERT_EQ(Aspose::Words::StyleIdentifier::Quote, sdt->get_Style()->get_StyleIdentifier());
ASSERT_EQ(u"Quote", sdt->get_StyleName());
}

◆ get_Tag()

System::String Aspose::Words::Markup::StructuredDocumentTag::get_Tag ( ) const

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

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_Title()

System::String Aspose::Words::Markup::StructuredDocumentTag::get_Title ( ) const

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

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ get_XmlMapping()

System::SharedPtr<Aspose::Words::Markup::XmlMapping> Aspose::Words::Markup::StructuredDocumentTag::get_XmlMapping ( ) const

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

Examples

Shows how to create structured document tag with a custom XML data.

auto doc = MakeObject<Document>();
// Construct an XML part that contains data and add it to the document's collection
// Once the "Developer" tab in Mircosoft Word is enabled,
// we can find elements from this collection as well as a couple defaults in the "XML Mapping Pane"
String xmlPartContent = u"<root><text>Hello world!</text></root>";
SharedPtr<Aspose::Words::Markup::CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(xmlPartId, xmlPartContent);
// The data we entered is stored in these attributes
ASPOSE_ASSERT_EQ(System::Text::Encoding::get_ASCII()->GetBytes(xmlPartContent), xmlPart->get_Data());
ASSERT_EQ(xmlPartId, xmlPart->get_Id());
// XML parts can be referenced by collection index or GUID
ASPOSE_ASSERT_EQ(xmlPart, doc->get_CustomXmlParts()->idx_get(0));
ASPOSE_ASSERT_EQ(xmlPart, doc->get_CustomXmlParts()->GetById(xmlPartId));
// Once the part is created, we can add XML schema associations like this
xmlPart->get_Schemas()->Add(u"http://www.w3.org/2001/XMLSchema");
// We can also clone parts and insert them into the collection directly
SharedPtr<Aspose::Words::Markup::CustomXmlPart> xmlPartClone = xmlPart->Clone();
xmlPartClone->set_Id(System::Guid::NewGuid().ToString(u"B"));
doc->get_CustomXmlParts()->Add(xmlPartClone);
ASSERT_EQ(2, doc->get_CustomXmlParts()->get_Count());
// Iterate through collection with an enumerator and print the contents of each part
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<Aspose::Words::Markup::CustomXmlPart>>> enumerator = doc->get_CustomXmlParts()->GetEnumerator();
int index = 0;
while (enumerator->MoveNext())
{
System::Console::WriteLine(String::Format(u"XML part index {0}, ID: {1}",index,enumerator->get_Current()->get_Id()));
System::Console::WriteLine(String::Format(u"\tContent: {0}",System::Text::Encoding::get_UTF8()->GetString(enumerator->get_Current()->get_Data())));
index++;
}
}
// XML parts can be removed by index
doc->get_CustomXmlParts()->RemoveAt(1);
ASSERT_EQ(1, doc->get_CustomXmlParts()->get_Count());
// The XML part collection itself can be cloned also
SharedPtr<CustomXmlPartCollection> customXmlParts = doc->get_CustomXmlParts()->Clone();
// And all elements can be cleared like this
customXmlParts->Clear();
// Create a StructuredDocumentTag that will display the contents of our part,
// insert it into the document and save the document
tag->get_XmlMapping()->SetMapping(xmlPart, u"/root[1]/text[1]", String::Empty);
doc->get_FirstSection()->get_Body()->AppendChild(tag);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.CustomXml.docx");

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Markup::StructuredDocumentTag::GetType ( ) const
overridevirtual

Reimplemented from Aspose::Words::CompositeNode.

◆ Is()

virtual bool Aspose::Words::Markup::StructuredDocumentTag::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from Aspose::Words::CompositeNode.

◆ RemoveSelfOnly()

void Aspose::Words::Markup::StructuredDocumentTag::RemoveSelfOnly ( )

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

Examples

Shows how to create a StructuredDocumentTag in the form of a plain text box and modify its appearance.

// Create a new document
auto doc = MakeObject<Document>();
// Create a StructuredDocumentTag that will contain plain text
// Set the title and color of the frame that appears when you mouse over it
tag->set_Title(u"My plain text");
// Set a programmatic tag for this StructuredDocumentTag
// Unlike the title, this value will not be visible in the document but will be programmatically obtainable
// as an XML element named "tag", with the string below in its "@val" attribute
tag->set_Tag(u"MyPlainTextSDT");
// Every StructuredDocumentTag gets a random unique ID
ASSERT_GT(tag->get_Id(), 0);
// Set the font for the text inside the StructuredDocumentTag
tag->get_ContentsFont()->set_Name(u"Arial");
// Set the font for the text at the end of the StructuredDocumentTag
// Any text that's typed in the document body after moving out of the tag with arrow keys will keep this font
tag->get_EndCharacterFont()->set_Name(u"Arial Black");
// By default, this is false and pressing enter while inside a StructuredDocumentTag does nothing
// When set to true, our StructuredDocumentTag can have multiple lines
tag->set_Multiline(true);
// Insert the StructuredDocumentTag into the document with a DocumentBuilder and save the document to a file
auto builder = MakeObject<DocumentBuilder>(doc);
builder->InsertNode(tag);
// Insert a clone of our StructuredDocumentTag in a new paragraph
auto tagClone = System::DynamicCast<Aspose::Words::Markup::StructuredDocumentTag>(tag->Clone(true));
builder->InsertParagraph();
builder->InsertNode(tagClone);
// We can remove the tag while keeping its contents where they were in the Paragraph by calling RemoveSelfOnly()
tagClone->RemoveSelfOnly();
doc->Save(ArtifactsDir + u"StructuredDocumentTag.PlainText.docx");

◆ set_BuildingBlockCategory()

void Aspose::Words::Markup::StructuredDocumentTag::set_BuildingBlockCategory ( System::String  value)

◆ set_BuildingBlockGallery()

void Aspose::Words::Markup::StructuredDocumentTag::set_BuildingBlockGallery ( System::String  value)

◆ set_CalendarType()

void Aspose::Words::Markup::StructuredDocumentTag::set_CalendarType ( Aspose::Words::Markup::SdtCalendarType  value)

◆ set_Checked()

void Aspose::Words::Markup::StructuredDocumentTag::set_Checked ( bool  value)

◆ set_Color()

void Aspose::Words::Markup::StructuredDocumentTag::set_Color ( System::Drawing::Color  value)

◆ set_DateDisplayFormat()

void Aspose::Words::Markup::StructuredDocumentTag::set_DateDisplayFormat ( System::String  value)

◆ set_DateDisplayLocale()

void Aspose::Words::Markup::StructuredDocumentTag::set_DateDisplayLocale ( int32_t  value)

◆ set_DateStorageFormat()

void Aspose::Words::Markup::StructuredDocumentTag::set_DateStorageFormat ( Aspose::Words::Markup::SdtDateStorageFormat  value)

◆ set_FullDate()

void Aspose::Words::Markup::StructuredDocumentTag::set_FullDate ( System::DateTime  value)

◆ set_IsShowingPlaceholderText()

void Aspose::Words::Markup::StructuredDocumentTag::set_IsShowingPlaceholderText ( bool  value)

◆ set_IsTemporary()

void Aspose::Words::Markup::StructuredDocumentTag::set_IsTemporary ( bool  value)

◆ set_LockContentControl()

void Aspose::Words::Markup::StructuredDocumentTag::set_LockContentControl ( bool  value)

◆ set_LockContents()

void Aspose::Words::Markup::StructuredDocumentTag::set_LockContents ( bool  value)

◆ set_Multiline()

void Aspose::Words::Markup::StructuredDocumentTag::set_Multiline ( bool  value)

◆ set_PlaceholderName()

void Aspose::Words::Markup::StructuredDocumentTag::set_PlaceholderName ( System::String  value)

◆ set_Style()

void Aspose::Words::Markup::StructuredDocumentTag::set_Style ( System::SharedPtr< Aspose::Words::Style value)

◆ set_StyleName()

void Aspose::Words::Markup::StructuredDocumentTag::set_StyleName ( System::String  value)

◆ set_Tag()

void Aspose::Words::Markup::StructuredDocumentTag::set_Tag ( System::String  value)

◆ set_Title()

void Aspose::Words::Markup::StructuredDocumentTag::set_Title ( System::String  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Markup::StructuredDocumentTag::Type ( )
static
String
@ RepeatingSection
The SDT represents repeating section type when displayed in the document.
static ASPOSECPP_SHARED_API Guid NewGuid()
@ Checkbox
The SDT represents a checkbox when displayed in the document.
@ Quote
@ Hijri
Specifies that the Hijri lunar calendar, as described by the Kingdom of Saudi Arabia,...
static ASPOSECPP_SHARED_API void WriteLine()
@ RichText
The SDT represents a rich text box when displayed in the document.
std::enable_if_t<!Details::IsIterable< Enumerable >::value, Details::EnumeratorAdapter< Enumerable, T > > IterateOver(System::SmartPtr< Enumerable > enumerable)
static ASPOSECPP_SHARED_API EncodingPtr get_UTF8()
@ Block
The element occurs at the block level (e.g. among tables and paragraphs).
@ DropDownList
The SDT represents a drop down list when displayed in the document.
@ RepeatingSectionItem
The SDT represents repeating section item.
@ BuildingBlockGallery
The SDT represents a building block gallery type.
SharedPtr< List< T > > LINQ_ToList()
static ASPOSECPP_SHARED_API Color get_Magenta()
ASPOSECPP_SHARED_API String ToString() const
@ DateTime
The date value for a date SDT is stored as a date in the standard XML Schema DateTime format.
static ASPOSECPP_SHARED_API EncodingPtr get_ASCII()
virtual ASPOSECPP_SHARED_API String ToString() const
static ASPOSECPP_SHARED_API CultureInfoPtr GetCultureInfo(const String &name)
@ Date
The SDT represents a date picker when displayed in the document.
@ Run
A run of text.
@ PlainText
The SDT represents a plain text box when displayed in the document.
@ StructuredDocumentTag
Allows to define customer-specific information and its means of presentation.
@ Inline
The element occurs at the inline level (e.g. among as runs of text).