Aspose::Words::Markup Namespace Reference

Detailed Description

The Aspose.Words.Markup namespace contains classes that represent customer defined semantics in a document: smart tags, custom XML and structured document tags (content controls).

Classes

class  CustomPart
 Represents a custom (arbitrary content) part, that is not defined by the ISO/IEC 29500 standard. More...
 
class  CustomPartCollection
 Represents a collection of CustomPart objects. More...
 
class  CustomXmlPart
 Represents a Custom XML Data Storage Part (custom XML data within a package). More...
 
class  CustomXmlPartCollection
 Represents a collection of Custom XML Parts. The items are CustomXmlPart objects. More...
 
class  CustomXmlProperty
 Represents a single custom XML attribute or a smart tag property. More...
 
class  CustomXmlPropertyCollection
 Represents a collection of custom XML attributes or smart tag properties. More...
 
class  CustomXmlSchemaCollection
 A collection of strings that represent XML schemas that are associated with a custom XML part. More...
 
class  SdtListItem
 This element specifies a single list item within a parent ComboBox or DropDownList structured document tag. More...
 
class  SdtListItemCollection
 Provides access to SdtListItem elements of a structured document tag. More...
 
class  SmartTag
 This element specifies the presence of a smart tag around one or more inline structures (runs, images, fields,etc.) within a paragraph. More...
 
class  StructuredDocumentTag
 Represents a structured document tag (SDT or content control) in a document. More...
 
class  StructuredDocumentTagRangeEnd
 Represents an end of ranged structured document tag which accepts multi-sections content. See also StructuredDocumentTagRangeStart node. More...
 
class  StructuredDocumentTagRangeStart
 Represents a start of ranged structured document tag which accepts multi-sections content. See also StructuredDocumentTagRangeEnd. More...
 
class  XmlMapping
 Specifies the information that is used to establish a mapping between the parent structured document tag and an XML element stored within a custom XML data part in the document. More...
 

Enumerations

enum class  MarkupLevel
 Specifies the level in the document tree where a particular StructuredDocumentTag can occur. More...
 
enum class  SdtCalendarType
 Specifies the possible types of calendars which can be used to specify CalendarType in an Office Open XML document. More...
 
enum class  SdtDateStorageFormat
 Specifies how the date for a date SDT is stored/retrieved when the SDT is bound to an XML node in the document's data store. More...
 
enum class  SdtType
 Specifies the type of a structured document tag (SDT) node. More...
 

Enumeration Type Documentation

◆ MarkupLevel

Specifies the level in the document tree where a particular StructuredDocumentTag can occur.

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 (auto node : System::IterateOver(tags))
{
auto sdt = System::DynamicCast<StructuredDocumentTag>(node);
ASSERT_EQ(StyleIdentifier::Quote, sdt->get_Style()->get_StyleIdentifier());
ASSERT_EQ(u"Quote", sdt->get_StyleName());
}
Enumerator
Unknown 

Specifies the unknown or invalid value.

Inline 

The element occurs at the inline level (e.g. among as runs of text).

Block 

The element occurs at the block level (e.g. among tables and paragraphs).

Row 

The element occurs among rows in a table.

Cell 

The element occurs among cells in a row.

◆ SdtCalendarType

Specifies the possible types of calendars which can be used to specify CalendarType in an Office Open XML document.

Enumerator
Default 

Used as default value in OOXML. Equals Gregorian.

Gregorian 

Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used. This calendar should be localized into the appropriate language.

GregorianArabic 

Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used. The values for this calendar should be presented in Arabic.

GregorianMeFrench 

Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used. The values for this calendar should be presented in Middle East French.

GregorianUs 

Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used. The values for this calendar should be presented in English.

GregorianXlitEnglish 

Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used. The values for this calendar should be the representation of the English strings in the corresponding Arabic characters (the Arabic transliteration of the English for the Gregorian calendar).

GregorianXlitFrench 

Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used. The values for this calendar should be the representation of the French strings in the corresponding Arabic characters (the Arabic transliteration of the French for the Gregorian calendar).

Hebrew 

Specifies that the Hebrew lunar calendar, as described by the Gauss formula for Passover [CITATION] and The Complete Restatement of Oral Law (Mishneh Torah),shall be used.

Hijri 

Specifies that the Hijri lunar calendar, as described by the Kingdom of Saudi Arabia, Ministry of Islamic Affairs, Endowments, Da‘wah and Guidance, shall be used.

Japan 

Specifies that the Japanese Emperor Era calendar, as described by Japanese Industrial Standard JIS X 0301, shall be used.

Korea 

Specifies that the Korean Tangun Era calendar, as described by Korean Law Enactment No. 4, shall be used.

None 

Specifies that no calendar should be used.

Saka 

Specifies that the Saka Era calendar, as described by the Calendar Reform Committee of India, as part of the Indian Ephemeris and Nautical Almanac, shall be used.

Taiwan 

Specifies that the Taiwanese calendar, as defined by the Chinese National Standard CNS 7648, shall be used.

Thai 

Specifies that the Thai calendar, as defined by the Royal Decree of H.M. King Vajiravudh (Rama VI) in Royal Gazette B. E. 2456 (1913 A.D.) and by the decree of Prime Minister Phibunsongkhram (1941 A.D.) to start the year on the Gregorian January 1 and to map year zero to Gregorian year 543 B.C., shall be used.

◆ SdtDateStorageFormat

Specifies how the date for a date SDT is stored/retrieved when the SDT is bound to an XML node in the document's data store.

Enumerator
Date 

The date value for a date SDT is stored as a date in the standard XML Schema Date format.

DateTime 

The date value for a date SDT is stored as a date in the standard XML Schema DateTime format.

Text 

The date value for a date SDT is stored as text.

Default 

Defaults to DateTime

◆ SdtType

Specifies the type of a structured document tag (SDT) node.

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 (auto node : System::IterateOver(tags))
{
auto sdt = System::DynamicCast<StructuredDocumentTag>(node);
ASSERT_EQ(StyleIdentifier::Quote, sdt->get_Style()->get_StyleIdentifier());
ASSERT_EQ(u"Quote", sdt->get_StyleName());
}

Shows how to fill a table with data from in an XML part.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<CustomXmlPart> xmlPart = doc->get_CustomXmlParts()->Add(
u"Books", String(u"<books>") + u"<book>" + u"<title>Everyday Italian</title>" + u"<author>Giada De Laurentiis</author>" + u"</book>" + u"<book>" +
u"<title>The C Programming Language</title>" + u"<author>Brian W. Kernighan, Dennis M. Ritchie</author>" + u"</book>" + u"<book>" +
u"<title>Learning XML</title>" + u"<author>Erik T. Ray</author>" + u"</book>" + u"</books>");
// Create headers for data from the XML content.
SharedPtr<Table> table = builder->StartTable();
builder->InsertCell();
builder->Write(u"Title");
builder->InsertCell();
builder->Write(u"Author");
builder->EndRow();
builder->EndTable();
// Create a table with a repeating section inside.
auto repeatingSectionSdt = MakeObject<StructuredDocumentTag>(doc, SdtType::RepeatingSection, MarkupLevel::Row);
repeatingSectionSdt->get_XmlMapping()->SetMapping(xmlPart, u"/books[1]/book", String::Empty);
table->AppendChild(repeatingSectionSdt);
// Add repeating section item inside the repeating section and mark it as a row.
// This table will have a row for each element that we can find in the XML document
// using the "/books[1]/book" XPath, of which there are three.
auto repeatingSectionItemSdt = MakeObject<StructuredDocumentTag>(doc, SdtType::RepeatingSectionItem, MarkupLevel::Row);
repeatingSectionSdt->AppendChild(repeatingSectionItemSdt);
auto row = MakeObject<Row>(doc);
repeatingSectionItemSdt->AppendChild(row);
// Map XML data with created table cells for the title and author of each book.
auto titleSdt = MakeObject<StructuredDocumentTag>(doc, SdtType::PlainText, MarkupLevel::Cell);
titleSdt->get_XmlMapping()->SetMapping(xmlPart, u"/books[1]/book[1]/title[1]", String::Empty);
row->AppendChild(titleSdt);
auto authorSdt = MakeObject<StructuredDocumentTag>(doc, SdtType::PlainText, MarkupLevel::Cell);
authorSdt->get_XmlMapping()->SetMapping(xmlPart, u"/books[1]/book[1]/author[1]", String::Empty);
row->AppendChild(authorSdt);
doc->Save(ArtifactsDir + u"StructuredDocumentTag.RepeatingSectionItem.docx");
Enumerator
None 

No type is assigned to the SDT.

Bibliography 

The SDT represents a bibliography entry.

Citation 

The SDT represents a citation.

Equation 

The SDT represents an equation.

DropDownList 

The SDT represents a drop down list when displayed in the document.

ComboBox 

The SDT represents a combo box when displayed in the document.

Date 

The SDT represents a date picker when displayed in the document.

BuildingBlockGallery 

The SDT represents a building block gallery type.

DocPartObj 

The SDT represents a document part type.

Group 

The SDT represents a restricted grouping when displayed in the document.

Picture 

The SDT represents a picture when displayed in the document.

RichText 

The SDT represents a rich text box when displayed in the document.

PlainText 

The SDT represents a plain text box when displayed in the document.

Checkbox 

The SDT represents a checkbox when displayed in the document.

RepeatingSection 

The SDT represents repeating section type when displayed in the document.

RepeatingSectionItem 

The SDT represents repeating section item.

EntityPicker 

The SDT represents an entity picker that allows the user to select an instance of an external content type.