Aspose::Words::InlineStory Class Referenceabstract

Detailed Description

Base class for inline-level nodes that can contain paragraphs and tables.

InlineStory is a container for block-level nodes Paragraph and Table.

The classes that derive from InlineStory are inline-level nodes that can contain their own text (paragraphs and tables). For example, a Comment node contains text of a comment and a Footnote contains text of a footnote.

Examples

Shows how to add a footnote to a paragraph in the document and set its marker.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add text that will be referenced by a footnote
builder->Write(u"Main body text.");
// Add a footnote and give it text, which will appear at the bottom of the page
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// This attribute means the footnote in the main text will automatically be assigned a number, "1" in this instance
// The next footnote will get "2"
ASSERT_TRUE(footnote->get_IsAuto());
// We can edit the footnote's text like this
// Make sure to move the builder back into the document body afterwards
builder->MoveTo(footnote->get_FirstParagraph());
builder->Write(u" More text added by a DocumentBuilder.");
builder->MoveToDocumentEnd();
ASSERT_EQ(u"Footnote text. More text added by a DocumentBuilder.", footnote->get_Paragraphs()->idx_get(0)->ToString(Aspose::Words::SaveFormat::Text).Trim());
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// Substitute the reference number for our own custom mark by setting this variable, "IsAuto" will also be set to false
footnote->set_ReferenceMark(u"RefMark");
ASSERT_FALSE(footnote->get_IsAuto());
// This bookmark will get a number "3" even though there was no "2"
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
ASSERT_TRUE(footnote->get_IsAuto());
doc->Save(ArtifactsDir + u"InlineStory.AddFootnote.docx");

Shows how to add a comment to a paragraph in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Write(u"Some text is added.");
auto comment = MakeObject<Comment>(doc, u"Amy Lee", u"AL", System::DateTime::get_Today());
builder->get_CurrentParagraph()->AppendChild(comment);
comment->get_Paragraphs()->Add(MakeObject<Paragraph>(doc));
comment->get_FirstParagraph()->get_Runs()->Add(MakeObject<Run>(doc, u"Comment text."));
doc->Save(ArtifactsDir + u"InlineStory.AddComment.docx");

#include <Aspose.Words.Cpp/Model/Text/InlineStory.h>

+ Inheritance diagram for Aspose::Words::InlineStory:

Public Member Functions

void EnsureMinimum ()
 If the last child is not a paragraph, creates and appends one empty paragraph. More...
 
SharedPtr< Paragraphget_FirstParagraph ()
 Gets the first paragraph in the story. More...
 
SharedPtr< Fontget_Font ()
 Provides access to the font formatting of the anchor character of this object. More...
 
bool get_IsDeleteRevision ()
 Returns true if this object was deleted in Microsoft Word while change tracking was enabled. More...
 
bool get_IsInsertRevision ()
 Returns true if this object was inserted in Microsoft Word while change tracking was enabled. More...
 
bool get_IsMoveFromRevision ()
 Returns true if this object was moved (deleted) in Microsoft Word while change tracking was enabled. More...
 
bool get_IsMoveToRevision ()
 Returns true if this object was moved (inserted) in Microsoft Word while change tracking was enabled. More...
 
SharedPtr< Paragraphget_LastParagraph ()
 Gets the last paragraph in the story. More...
 
SharedPtr< ParagraphCollectionget_Paragraphs ()
 Gets a collection of paragraphs that are immediate children of the story. More...
 
SharedPtr< Paragraphget_ParentParagraph ()
 Retrieves the parent Paragraph of this node. More...
 
virtual StoryType get_StoryType ()=0
 Returns the type of the story. More...
 
SharedPtr< TableCollectionget_Tables ()
 Gets a collection of tables that are immediate children of the story. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
- 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
virtual bool Accept (SharedPtr< DocumentVisitor > visitor)=0
 Accepts a visitor. More...
 
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...
 
virtual NodeType get_NodeType () const =0
 Gets the type of 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
 

Member Function Documentation

◆ EnsureMinimum()

void Aspose::Words::InlineStory::EnsureMinimum ( )

If the last child is not a paragraph, creates and appends one empty paragraph.

Examples

Shows how to insert InlineStory nodes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, nullptr);
// Table nodes have an "EnsureMinimum()" method that makes sure the table has at least one cell
auto table = MakeObject<Table>(doc);
table->EnsureMinimum();
// We can place a table inside a footnote, which will make it appear at the footer of the referencing page
ASSERT_TRUE(footnote->get_Tables()->get_Count() == 0);
footnote->AppendChild(table);
ASSERT_EQ(1, footnote->get_Tables()->get_Count());
ASSERT_EQ(Aspose::Words::NodeType::Table, footnote->get_LastChild()->get_NodeType());
// An InlineStory has an "EnsureMinimum()" method as well, but in this case it makes sure the last child of the node is a paragraph,
// so we can click and write text easily in Microsoft Word
footnote->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, footnote->get_LastChild()->get_NodeType());
// Edit the appearance of the anchor, which is the small superscript number in the main text that points to the footnote
footnote->get_Font()->set_Name(u"Arial");
footnote->get_Font()->set_Color(System::Drawing::Color::get_Green());
// All inline story nodes have their own respective story types
ASSERT_EQ(Aspose::Words::StoryType::Footnotes, footnote->get_StoryType());
// A comment is another type of inline story
auto comment = System::DynamicCast<Aspose::Words::Comment>(builder->get_CurrentParagraph()->AppendChild(MakeObject<Comment>(doc, u"John Doe", u"J. D.", System::DateTime::get_Now())));
// The parent paragraph of an inline story node will be the one from the main document body
ASPOSE_ASSERT_EQ(doc->get_FirstSection()->get_Body()->get_FirstParagraph(), comment->get_ParentParagraph());
// However, the last paragraph is the one from the comment text contents, which will be outside the main document body in a speech bubble
// A comment won't have any child nodes by default, so we can apply the EnsureMinimum() method to place a paragraph here as well
ASSERT_TRUE(comment->get_LastParagraph() == nullptr);
comment->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, comment->get_LastChild()->get_NodeType());
// Once we have a paragraph, we can move the builder do it and write our comment
builder->MoveTo(comment->get_LastParagraph());
builder->Write(u"My comment.");
ASSERT_EQ(Aspose::Words::StoryType::Comments, comment->get_StoryType());
doc->Save(ArtifactsDir + u"InlineStory.InsertInlineStoryNodes.docx");

◆ get_FirstParagraph()

System::SharedPtr<Aspose::Words::Paragraph> Aspose::Words::InlineStory::get_FirstParagraph ( )

Gets the first paragraph in the story.

Examples

Shows how to add a footnote to a paragraph in the document and set its marker.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add text that will be referenced by a footnote
builder->Write(u"Main body text.");
// Add a footnote and give it text, which will appear at the bottom of the page
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// This attribute means the footnote in the main text will automatically be assigned a number, "1" in this instance
// The next footnote will get "2"
ASSERT_TRUE(footnote->get_IsAuto());
// We can edit the footnote's text like this
// Make sure to move the builder back into the document body afterwards
builder->MoveTo(footnote->get_FirstParagraph());
builder->Write(u" More text added by a DocumentBuilder.");
builder->MoveToDocumentEnd();
ASSERT_EQ(u"Footnote text. More text added by a DocumentBuilder.", footnote->get_Paragraphs()->idx_get(0)->ToString(Aspose::Words::SaveFormat::Text).Trim());
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// Substitute the reference number for our own custom mark by setting this variable, "IsAuto" will also be set to false
footnote->set_ReferenceMark(u"RefMark");
ASSERT_FALSE(footnote->get_IsAuto());
// This bookmark will get a number "3" even though there was no "2"
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
ASSERT_TRUE(footnote->get_IsAuto());
doc->Save(ArtifactsDir + u"InlineStory.AddFootnote.docx");

Shows how to add a comment to a paragraph in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Write(u"Some text is added.");
auto comment = MakeObject<Comment>(doc, u"Amy Lee", u"AL", System::DateTime::get_Today());
builder->get_CurrentParagraph()->AppendChild(comment);
comment->get_Paragraphs()->Add(MakeObject<Paragraph>(doc));
comment->get_FirstParagraph()->get_Runs()->Add(MakeObject<Run>(doc, u"Comment text."));
doc->Save(ArtifactsDir + u"InlineStory.AddComment.docx");

◆ get_Font()

System::SharedPtr<Aspose::Words::Font> Aspose::Words::InlineStory::get_Font ( )

Provides access to the font formatting of the anchor character of this object.

Examples

Shows how to insert InlineStory nodes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, nullptr);
// Table nodes have an "EnsureMinimum()" method that makes sure the table has at least one cell
auto table = MakeObject<Table>(doc);
table->EnsureMinimum();
// We can place a table inside a footnote, which will make it appear at the footer of the referencing page
ASSERT_TRUE(footnote->get_Tables()->get_Count() == 0);
footnote->AppendChild(table);
ASSERT_EQ(1, footnote->get_Tables()->get_Count());
ASSERT_EQ(Aspose::Words::NodeType::Table, footnote->get_LastChild()->get_NodeType());
// An InlineStory has an "EnsureMinimum()" method as well, but in this case it makes sure the last child of the node is a paragraph,
// so we can click and write text easily in Microsoft Word
footnote->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, footnote->get_LastChild()->get_NodeType());
// Edit the appearance of the anchor, which is the small superscript number in the main text that points to the footnote
footnote->get_Font()->set_Name(u"Arial");
footnote->get_Font()->set_Color(System::Drawing::Color::get_Green());
// All inline story nodes have their own respective story types
ASSERT_EQ(Aspose::Words::StoryType::Footnotes, footnote->get_StoryType());
// A comment is another type of inline story
auto comment = System::DynamicCast<Aspose::Words::Comment>(builder->get_CurrentParagraph()->AppendChild(MakeObject<Comment>(doc, u"John Doe", u"J. D.", System::DateTime::get_Now())));
// The parent paragraph of an inline story node will be the one from the main document body
ASPOSE_ASSERT_EQ(doc->get_FirstSection()->get_Body()->get_FirstParagraph(), comment->get_ParentParagraph());
// However, the last paragraph is the one from the comment text contents, which will be outside the main document body in a speech bubble
// A comment won't have any child nodes by default, so we can apply the EnsureMinimum() method to place a paragraph here as well
ASSERT_TRUE(comment->get_LastParagraph() == nullptr);
comment->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, comment->get_LastChild()->get_NodeType());
// Once we have a paragraph, we can move the builder do it and write our comment
builder->MoveTo(comment->get_LastParagraph());
builder->Write(u"My comment.");
ASSERT_EQ(Aspose::Words::StoryType::Comments, comment->get_StoryType());
doc->Save(ArtifactsDir + u"InlineStory.InsertInlineStoryNodes.docx");

◆ get_IsDeleteRevision()

bool Aspose::Words::InlineStory::get_IsDeleteRevision ( )

Returns true if this object was deleted in Microsoft Word while change tracking was enabled.

Examples

Shows how to view revision-related properties of InlineStory nodes.

// Open a document that has revisions from changes being tracked
auto doc = MakeObject<Document>(MyDir + u"Revision footnotes.docx");
ASSERT_TRUE(doc->get_HasRevisions());
// Get a collection of all footnotes from the document
SharedPtr<System::Collections::Generic::List<SharedPtr<Footnote>>> footnotes = doc->GetChildNodes(Aspose::Words::NodeType::Footnote, true)->LINQ_Cast<SharedPtr<Footnote> >()->LINQ_ToList();
ASSERT_EQ(5, footnotes->get_Count());
// If a node was inserted in Microsoft Word while changes were being tracked, this flag will be set to true
ASSERT_TRUE(footnotes->idx_get(2)->get_IsInsertRevision());
// If one node was moved from one place to another while changes were tracked,
// the node will be placed at the departure location as a "move to revision",
// and a "move from revision" node will be left behind at the origin, in case we want to reject changes
// Highlighting text and dragging it to another place with the mouse and cut-and-pasting (but not copy-pasting) both count as "move revisions"
// The node with the "IsMoveToRevision" flag is the arrival of the move operation, and the node with the "IsMoveFromRevision" flag is the departure point
ASSERT_TRUE(footnotes->idx_get(1)->get_IsMoveToRevision());
ASSERT_TRUE(footnotes->idx_get(4)->get_IsMoveFromRevision());
// If a node was deleted while changes were being tracked, it will stay behind as a delete revision until we accept/reject changes
ASSERT_TRUE(footnotes->idx_get(3)->get_IsDeleteRevision());

◆ get_IsInsertRevision()

bool Aspose::Words::InlineStory::get_IsInsertRevision ( )

Returns true if this object was inserted in Microsoft Word while change tracking was enabled.

Examples

Shows how to view revision-related properties of InlineStory nodes.

// Open a document that has revisions from changes being tracked
auto doc = MakeObject<Document>(MyDir + u"Revision footnotes.docx");
ASSERT_TRUE(doc->get_HasRevisions());
// Get a collection of all footnotes from the document
SharedPtr<System::Collections::Generic::List<SharedPtr<Footnote>>> footnotes = doc->GetChildNodes(Aspose::Words::NodeType::Footnote, true)->LINQ_Cast<SharedPtr<Footnote> >()->LINQ_ToList();
ASSERT_EQ(5, footnotes->get_Count());
// If a node was inserted in Microsoft Word while changes were being tracked, this flag will be set to true
ASSERT_TRUE(footnotes->idx_get(2)->get_IsInsertRevision());
// If one node was moved from one place to another while changes were tracked,
// the node will be placed at the departure location as a "move to revision",
// and a "move from revision" node will be left behind at the origin, in case we want to reject changes
// Highlighting text and dragging it to another place with the mouse and cut-and-pasting (but not copy-pasting) both count as "move revisions"
// The node with the "IsMoveToRevision" flag is the arrival of the move operation, and the node with the "IsMoveFromRevision" flag is the departure point
ASSERT_TRUE(footnotes->idx_get(1)->get_IsMoveToRevision());
ASSERT_TRUE(footnotes->idx_get(4)->get_IsMoveFromRevision());
// If a node was deleted while changes were being tracked, it will stay behind as a delete revision until we accept/reject changes
ASSERT_TRUE(footnotes->idx_get(3)->get_IsDeleteRevision());

◆ get_IsMoveFromRevision()

bool Aspose::Words::InlineStory::get_IsMoveFromRevision ( )

Returns true if this object was moved (deleted) in Microsoft Word while change tracking was enabled.

Examples

Shows how to view revision-related properties of InlineStory nodes.

// Open a document that has revisions from changes being tracked
auto doc = MakeObject<Document>(MyDir + u"Revision footnotes.docx");
ASSERT_TRUE(doc->get_HasRevisions());
// Get a collection of all footnotes from the document
SharedPtr<System::Collections::Generic::List<SharedPtr<Footnote>>> footnotes = doc->GetChildNodes(Aspose::Words::NodeType::Footnote, true)->LINQ_Cast<SharedPtr<Footnote> >()->LINQ_ToList();
ASSERT_EQ(5, footnotes->get_Count());
// If a node was inserted in Microsoft Word while changes were being tracked, this flag will be set to true
ASSERT_TRUE(footnotes->idx_get(2)->get_IsInsertRevision());
// If one node was moved from one place to another while changes were tracked,
// the node will be placed at the departure location as a "move to revision",
// and a "move from revision" node will be left behind at the origin, in case we want to reject changes
// Highlighting text and dragging it to another place with the mouse and cut-and-pasting (but not copy-pasting) both count as "move revisions"
// The node with the "IsMoveToRevision" flag is the arrival of the move operation, and the node with the "IsMoveFromRevision" flag is the departure point
ASSERT_TRUE(footnotes->idx_get(1)->get_IsMoveToRevision());
ASSERT_TRUE(footnotes->idx_get(4)->get_IsMoveFromRevision());
// If a node was deleted while changes were being tracked, it will stay behind as a delete revision until we accept/reject changes
ASSERT_TRUE(footnotes->idx_get(3)->get_IsDeleteRevision());

◆ get_IsMoveToRevision()

bool Aspose::Words::InlineStory::get_IsMoveToRevision ( )

Returns true if this object was moved (inserted) in Microsoft Word while change tracking was enabled.

Examples

Shows how to view revision-related properties of InlineStory nodes.

// Open a document that has revisions from changes being tracked
auto doc = MakeObject<Document>(MyDir + u"Revision footnotes.docx");
ASSERT_TRUE(doc->get_HasRevisions());
// Get a collection of all footnotes from the document
SharedPtr<System::Collections::Generic::List<SharedPtr<Footnote>>> footnotes = doc->GetChildNodes(Aspose::Words::NodeType::Footnote, true)->LINQ_Cast<SharedPtr<Footnote> >()->LINQ_ToList();
ASSERT_EQ(5, footnotes->get_Count());
// If a node was inserted in Microsoft Word while changes were being tracked, this flag will be set to true
ASSERT_TRUE(footnotes->idx_get(2)->get_IsInsertRevision());
// If one node was moved from one place to another while changes were tracked,
// the node will be placed at the departure location as a "move to revision",
// and a "move from revision" node will be left behind at the origin, in case we want to reject changes
// Highlighting text and dragging it to another place with the mouse and cut-and-pasting (but not copy-pasting) both count as "move revisions"
// The node with the "IsMoveToRevision" flag is the arrival of the move operation, and the node with the "IsMoveFromRevision" flag is the departure point
ASSERT_TRUE(footnotes->idx_get(1)->get_IsMoveToRevision());
ASSERT_TRUE(footnotes->idx_get(4)->get_IsMoveFromRevision());
// If a node was deleted while changes were being tracked, it will stay behind as a delete revision until we accept/reject changes
ASSERT_TRUE(footnotes->idx_get(3)->get_IsDeleteRevision());

◆ get_LastParagraph()

System::SharedPtr<Aspose::Words::Paragraph> Aspose::Words::InlineStory::get_LastParagraph ( )

Gets the last paragraph in the story.

Examples

Shows how to insert InlineStory nodes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, nullptr);
// Table nodes have an "EnsureMinimum()" method that makes sure the table has at least one cell
auto table = MakeObject<Table>(doc);
table->EnsureMinimum();
// We can place a table inside a footnote, which will make it appear at the footer of the referencing page
ASSERT_TRUE(footnote->get_Tables()->get_Count() == 0);
footnote->AppendChild(table);
ASSERT_EQ(1, footnote->get_Tables()->get_Count());
ASSERT_EQ(Aspose::Words::NodeType::Table, footnote->get_LastChild()->get_NodeType());
// An InlineStory has an "EnsureMinimum()" method as well, but in this case it makes sure the last child of the node is a paragraph,
// so we can click and write text easily in Microsoft Word
footnote->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, footnote->get_LastChild()->get_NodeType());
// Edit the appearance of the anchor, which is the small superscript number in the main text that points to the footnote
footnote->get_Font()->set_Name(u"Arial");
footnote->get_Font()->set_Color(System::Drawing::Color::get_Green());
// All inline story nodes have their own respective story types
ASSERT_EQ(Aspose::Words::StoryType::Footnotes, footnote->get_StoryType());
// A comment is another type of inline story
auto comment = System::DynamicCast<Aspose::Words::Comment>(builder->get_CurrentParagraph()->AppendChild(MakeObject<Comment>(doc, u"John Doe", u"J. D.", System::DateTime::get_Now())));
// The parent paragraph of an inline story node will be the one from the main document body
ASPOSE_ASSERT_EQ(doc->get_FirstSection()->get_Body()->get_FirstParagraph(), comment->get_ParentParagraph());
// However, the last paragraph is the one from the comment text contents, which will be outside the main document body in a speech bubble
// A comment won't have any child nodes by default, so we can apply the EnsureMinimum() method to place a paragraph here as well
ASSERT_TRUE(comment->get_LastParagraph() == nullptr);
comment->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, comment->get_LastChild()->get_NodeType());
// Once we have a paragraph, we can move the builder do it and write our comment
builder->MoveTo(comment->get_LastParagraph());
builder->Write(u"My comment.");
ASSERT_EQ(Aspose::Words::StoryType::Comments, comment->get_StoryType());
doc->Save(ArtifactsDir + u"InlineStory.InsertInlineStoryNodes.docx");

◆ get_Paragraphs()

System::SharedPtr<Aspose::Words::ParagraphCollection> Aspose::Words::InlineStory::get_Paragraphs ( )

Gets a collection of paragraphs that are immediate children of the story.

Examples

Shows how to add a footnote to a paragraph in the document and set its marker.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Add text that will be referenced by a footnote
builder->Write(u"Main body text.");
// Add a footnote and give it text, which will appear at the bottom of the page
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// This attribute means the footnote in the main text will automatically be assigned a number, "1" in this instance
// The next footnote will get "2"
ASSERT_TRUE(footnote->get_IsAuto());
// We can edit the footnote's text like this
// Make sure to move the builder back into the document body afterwards
builder->MoveTo(footnote->get_FirstParagraph());
builder->Write(u" More text added by a DocumentBuilder.");
builder->MoveToDocumentEnd();
ASSERT_EQ(u"Footnote text. More text added by a DocumentBuilder.", footnote->get_Paragraphs()->idx_get(0)->ToString(Aspose::Words::SaveFormat::Text).Trim());
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
// Substitute the reference number for our own custom mark by setting this variable, "IsAuto" will also be set to false
footnote->set_ReferenceMark(u"RefMark");
ASSERT_FALSE(footnote->get_IsAuto());
// This bookmark will get a number "3" even though there was no "2"
builder->Write(u" More main body text.");
footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, u"Footnote text.");
ASSERT_TRUE(footnote->get_IsAuto());
doc->Save(ArtifactsDir + u"InlineStory.AddFootnote.docx");

Shows how to add a comment to a paragraph in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Write(u"Some text is added.");
auto comment = MakeObject<Comment>(doc, u"Amy Lee", u"AL", System::DateTime::get_Today());
builder->get_CurrentParagraph()->AppendChild(comment);
comment->get_Paragraphs()->Add(MakeObject<Paragraph>(doc));
comment->get_FirstParagraph()->get_Runs()->Add(MakeObject<Run>(doc, u"Comment text."));
doc->Save(ArtifactsDir + u"InlineStory.AddComment.docx");

◆ get_ParentParagraph()

System::SharedPtr<Aspose::Words::Paragraph> Aspose::Words::InlineStory::get_ParentParagraph ( )

Retrieves the parent Paragraph of this node.

Examples

Shows how to insert InlineStory nodes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, nullptr);
// Table nodes have an "EnsureMinimum()" method that makes sure the table has at least one cell
auto table = MakeObject<Table>(doc);
table->EnsureMinimum();
// We can place a table inside a footnote, which will make it appear at the footer of the referencing page
ASSERT_TRUE(footnote->get_Tables()->get_Count() == 0);
footnote->AppendChild(table);
ASSERT_EQ(1, footnote->get_Tables()->get_Count());
ASSERT_EQ(Aspose::Words::NodeType::Table, footnote->get_LastChild()->get_NodeType());
// An InlineStory has an "EnsureMinimum()" method as well, but in this case it makes sure the last child of the node is a paragraph,
// so we can click and write text easily in Microsoft Word
footnote->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, footnote->get_LastChild()->get_NodeType());
// Edit the appearance of the anchor, which is the small superscript number in the main text that points to the footnote
footnote->get_Font()->set_Name(u"Arial");
footnote->get_Font()->set_Color(System::Drawing::Color::get_Green());
// All inline story nodes have their own respective story types
ASSERT_EQ(Aspose::Words::StoryType::Footnotes, footnote->get_StoryType());
// A comment is another type of inline story
auto comment = System::DynamicCast<Aspose::Words::Comment>(builder->get_CurrentParagraph()->AppendChild(MakeObject<Comment>(doc, u"John Doe", u"J. D.", System::DateTime::get_Now())));
// The parent paragraph of an inline story node will be the one from the main document body
ASPOSE_ASSERT_EQ(doc->get_FirstSection()->get_Body()->get_FirstParagraph(), comment->get_ParentParagraph());
// However, the last paragraph is the one from the comment text contents, which will be outside the main document body in a speech bubble
// A comment won't have any child nodes by default, so we can apply the EnsureMinimum() method to place a paragraph here as well
ASSERT_TRUE(comment->get_LastParagraph() == nullptr);
comment->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, comment->get_LastChild()->get_NodeType());
// Once we have a paragraph, we can move the builder do it and write our comment
builder->MoveTo(comment->get_LastParagraph());
builder->Write(u"My comment.");
ASSERT_EQ(Aspose::Words::StoryType::Comments, comment->get_StoryType());
doc->Save(ArtifactsDir + u"InlineStory.InsertInlineStoryNodes.docx");

◆ get_StoryType()

virtual Aspose::Words::StoryType Aspose::Words::InlineStory::get_StoryType ( )
pure virtual

Returns the type of the story.

Examples

Shows how to insert InlineStory nodes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, nullptr);
// Table nodes have an "EnsureMinimum()" method that makes sure the table has at least one cell
auto table = MakeObject<Table>(doc);
table->EnsureMinimum();
// We can place a table inside a footnote, which will make it appear at the footer of the referencing page
ASSERT_TRUE(footnote->get_Tables()->get_Count() == 0);
footnote->AppendChild(table);
ASSERT_EQ(1, footnote->get_Tables()->get_Count());
ASSERT_EQ(Aspose::Words::NodeType::Table, footnote->get_LastChild()->get_NodeType());
// An InlineStory has an "EnsureMinimum()" method as well, but in this case it makes sure the last child of the node is a paragraph,
// so we can click and write text easily in Microsoft Word
footnote->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, footnote->get_LastChild()->get_NodeType());
// Edit the appearance of the anchor, which is the small superscript number in the main text that points to the footnote
footnote->get_Font()->set_Name(u"Arial");
footnote->get_Font()->set_Color(System::Drawing::Color::get_Green());
// All inline story nodes have their own respective story types
ASSERT_EQ(Aspose::Words::StoryType::Footnotes, footnote->get_StoryType());
// A comment is another type of inline story
auto comment = System::DynamicCast<Aspose::Words::Comment>(builder->get_CurrentParagraph()->AppendChild(MakeObject<Comment>(doc, u"John Doe", u"J. D.", System::DateTime::get_Now())));
// The parent paragraph of an inline story node will be the one from the main document body
ASPOSE_ASSERT_EQ(doc->get_FirstSection()->get_Body()->get_FirstParagraph(), comment->get_ParentParagraph());
// However, the last paragraph is the one from the comment text contents, which will be outside the main document body in a speech bubble
// A comment won't have any child nodes by default, so we can apply the EnsureMinimum() method to place a paragraph here as well
ASSERT_TRUE(comment->get_LastParagraph() == nullptr);
comment->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, comment->get_LastChild()->get_NodeType());
// Once we have a paragraph, we can move the builder do it and write our comment
builder->MoveTo(comment->get_LastParagraph());
builder->Write(u"My comment.");
ASSERT_EQ(Aspose::Words::StoryType::Comments, comment->get_StoryType());
doc->Save(ArtifactsDir + u"InlineStory.InsertInlineStoryNodes.docx");

Implemented in Aspose::Words::Comment, and Aspose::Words::Footnote.

◆ get_Tables()

System::SharedPtr<Aspose::Words::Tables::TableCollection> Aspose::Words::InlineStory::get_Tables ( )

Gets a collection of tables that are immediate children of the story.

Examples

Shows how to insert InlineStory nodes.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Footnote> footnote = builder->InsertFootnote(Aspose::Words::FootnoteType::Footnote, nullptr);
// Table nodes have an "EnsureMinimum()" method that makes sure the table has at least one cell
auto table = MakeObject<Table>(doc);
table->EnsureMinimum();
// We can place a table inside a footnote, which will make it appear at the footer of the referencing page
ASSERT_TRUE(footnote->get_Tables()->get_Count() == 0);
footnote->AppendChild(table);
ASSERT_EQ(1, footnote->get_Tables()->get_Count());
ASSERT_EQ(Aspose::Words::NodeType::Table, footnote->get_LastChild()->get_NodeType());
// An InlineStory has an "EnsureMinimum()" method as well, but in this case it makes sure the last child of the node is a paragraph,
// so we can click and write text easily in Microsoft Word
footnote->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, footnote->get_LastChild()->get_NodeType());
// Edit the appearance of the anchor, which is the small superscript number in the main text that points to the footnote
footnote->get_Font()->set_Name(u"Arial");
footnote->get_Font()->set_Color(System::Drawing::Color::get_Green());
// All inline story nodes have their own respective story types
ASSERT_EQ(Aspose::Words::StoryType::Footnotes, footnote->get_StoryType());
// A comment is another type of inline story
auto comment = System::DynamicCast<Aspose::Words::Comment>(builder->get_CurrentParagraph()->AppendChild(MakeObject<Comment>(doc, u"John Doe", u"J. D.", System::DateTime::get_Now())));
// The parent paragraph of an inline story node will be the one from the main document body
ASPOSE_ASSERT_EQ(doc->get_FirstSection()->get_Body()->get_FirstParagraph(), comment->get_ParentParagraph());
// However, the last paragraph is the one from the comment text contents, which will be outside the main document body in a speech bubble
// A comment won't have any child nodes by default, so we can apply the EnsureMinimum() method to place a paragraph here as well
ASSERT_TRUE(comment->get_LastParagraph() == nullptr);
comment->EnsureMinimum();
ASSERT_EQ(Aspose::Words::NodeType::Paragraph, comment->get_LastChild()->get_NodeType());
// Once we have a paragraph, we can move the builder do it and write our comment
builder->MoveTo(comment->get_LastParagraph());
builder->Write(u"My comment.");
ASSERT_EQ(Aspose::Words::StoryType::Comments, comment->get_StoryType());
doc->Save(ArtifactsDir + u"InlineStory.InsertInlineStoryNodes.docx");

◆ GetType()

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

◆ Is()

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

◆ Type()

static const System::TypeInfo& Aspose::Words::InlineStory::Type ( )
static
static ASPOSECPP_SHARED_API DateTime get_Now()
@ Text
Saves the document in the plain text format.
@ Comments
Contains document comments (annotations), represented by Comment.
SharedPtr< List< T > > LINQ_ToList()
static ASPOSECPP_SHARED_API Color get_Green()
@ Footnotes
Contains footnote text, represented by Footnote.
@ Footnote
A footnote or endnote in a Word document. A Footnote node can have Paragraph and Table nodes.
static ASPOSECPP_SHARED_API DateTime get_Today()
@ Footnote
The object is a footnote.
@ Paragraph
A paragraph of text. A Paragraph node is a container for inline level elements Run,...
@ Table
A Table object that represents a table in a Word document. A Table node can have Row nodes.