Aspose::Words::Fields::FieldChar Class Reference

Detailed Description

Base class for nodes that represent field characters in a document.

A complete field in a Microsoft Word document is a complex structure consisting of a field start character, field code, field separator character, field result and field end character. Some fields only have field start, field code and field end.

To easily insert a new field into a document, use the InsertField() method.

See also
Aspose::Words::Fields::FieldStart
Aspose::Words::Fields::FieldSeparator
Aspose::Words::Fields::FieldEnd
Examples

Demonstrates how to retrieve the field class from an existing FieldStart node in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldDate>(builder->InsertField(FieldType::FieldDate, true));
field->get_Format()->set_DateTimeFormat(u"dddd, MMMM dd, yyyy");
field->Update();
SharedPtr<FieldChar> fieldStart = field->get_Start();
ASSERT_EQ(FieldType::FieldDate, fieldStart->get_FieldType());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsDirty());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsLocked());
// Retrieve the facade object which represents the field in the document
field = System::DynamicCast<FieldDate>(fieldStart->GetField());
ASPOSE_ASSERT_EQ(false, field->get_IsLocked());
ASSERT_EQ(u" DATE \\@ \"dddd, MMMM dd, yyyy\"", field->GetFieldCode());
// This updates only this field in the document
field->Update();

#include <Aspose.Words.Cpp/Model/Fields/Nodes/FieldChar.h>

+ Inheritance diagram for Aspose::Words::Fields::FieldChar:

Public Member Functions

FieldType get_FieldType () const
 Returns the type of the field. More...
 
bool get_IsDirty () const
 Gets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document. More...
 
bool get_IsLocked () const
 Gets or sets whether the parent field is locked (should not recalculate its result). More...
 
SharedPtr< FieldGetField ()
 Returns a field for the field char. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_IsDirty (bool value)
 Setter for get_IsDirty. More...
 
void set_IsLocked (bool value)
 Setter for get_IsLocked. More...
 
- Public Member Functions inherited from SpecialChar
bool Accept (SharedPtr< DocumentVisitor > visitor) override
 Accepts a visitor. More...
 
NodeType get_NodeType () const override
 Returns NodeType.SpecialChar. More...
 
String GetText () override
 Gets the special character that this node represents. More...
 
- Public Member Functions inherited from Inline
SharedPtr< Fontget_Font ()
 Provides access to the font formatting 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_IsFormatRevision ()
 Returns true if formatting of the object was changed 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_ParentParagraph ()
 Retrieves the parent Paragraph of this node. More...
 
- Public Member Functions inherited from Node
SharedPtr< NodeClone (bool isCloneChildren)
 
virtual SharedPtr< DocumentBaseget_Document () const
 Gets the document to which this node belongs. More...
 
virtual bool get_IsComposite ()
 Returns true if this node can contain other nodes. 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 ()
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from SpecialChar
static const TypeInfoType ()
 
- Static Public Member Functions inherited from Inline
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
 

Member Function Documentation

◆ get_FieldType()

Aspose::Words::Fields::FieldType Aspose::Words::Fields::FieldChar::get_FieldType ( ) const

Returns the type of the field.

Examples

Demonstrates how to retrieve the field class from an existing FieldStart node in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldDate>(builder->InsertField(FieldType::FieldDate, true));
field->get_Format()->set_DateTimeFormat(u"dddd, MMMM dd, yyyy");
field->Update();
SharedPtr<FieldChar> fieldStart = field->get_Start();
ASSERT_EQ(FieldType::FieldDate, fieldStart->get_FieldType());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsDirty());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsLocked());
// Retrieve the facade object which represents the field in the document
field = System::DynamicCast<FieldDate>(fieldStart->GetField());
ASPOSE_ASSERT_EQ(false, field->get_IsLocked());
ASSERT_EQ(u" DATE \\@ \"dddd, MMMM dd, yyyy\"", field->GetFieldCode());
// This updates only this field in the document
field->Update();

◆ get_IsDirty()

bool Aspose::Words::Fields::FieldChar::get_IsDirty ( ) const

Gets or sets whether the current result of the field is no longer correct (stale) due to other modifications made to the document.

Examples

Demonstrates how to retrieve the field class from an existing FieldStart node in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldDate>(builder->InsertField(FieldType::FieldDate, true));
field->get_Format()->set_DateTimeFormat(u"dddd, MMMM dd, yyyy");
field->Update();
SharedPtr<FieldChar> fieldStart = field->get_Start();
ASSERT_EQ(FieldType::FieldDate, fieldStart->get_FieldType());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsDirty());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsLocked());
// Retrieve the facade object which represents the field in the document
field = System::DynamicCast<FieldDate>(fieldStart->GetField());
ASPOSE_ASSERT_EQ(false, field->get_IsLocked());
ASSERT_EQ(u" DATE \\@ \"dddd, MMMM dd, yyyy\"", field->GetFieldCode());
// This updates only this field in the document
field->Update();

◆ get_IsLocked()

bool Aspose::Words::Fields::FieldChar::get_IsLocked ( ) const

Gets or sets whether the parent field is locked (should not recalculate its result).

Examples

Demonstrates how to retrieve the field class from an existing FieldStart node in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldDate>(builder->InsertField(FieldType::FieldDate, true));
field->get_Format()->set_DateTimeFormat(u"dddd, MMMM dd, yyyy");
field->Update();
SharedPtr<FieldChar> fieldStart = field->get_Start();
ASSERT_EQ(FieldType::FieldDate, fieldStart->get_FieldType());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsDirty());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsLocked());
// Retrieve the facade object which represents the field in the document
field = System::DynamicCast<FieldDate>(fieldStart->GetField());
ASPOSE_ASSERT_EQ(false, field->get_IsLocked());
ASSERT_EQ(u" DATE \\@ \"dddd, MMMM dd, yyyy\"", field->GetFieldCode());
// This updates only this field in the document
field->Update();

◆ GetField()

System::SharedPtr<Aspose::Words::Fields::Field> Aspose::Words::Fields::FieldChar::GetField ( )

Returns a field for the field char.

Returns
A field for the field char.
Examples

Demonstrates how to retrieve the field class from an existing FieldStart node in the document.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldDate>(builder->InsertField(FieldType::FieldDate, true));
field->get_Format()->set_DateTimeFormat(u"dddd, MMMM dd, yyyy");
field->Update();
SharedPtr<FieldChar> fieldStart = field->get_Start();
ASSERT_EQ(FieldType::FieldDate, fieldStart->get_FieldType());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsDirty());
ASPOSE_ASSERT_EQ(false, fieldStart->get_IsLocked());
// Retrieve the facade object which represents the field in the document
field = System::DynamicCast<FieldDate>(fieldStart->GetField());
ASPOSE_ASSERT_EQ(false, field->get_IsLocked());
ASSERT_EQ(u" DATE \\@ \"dddd, MMMM dd, yyyy\"", field->GetFieldCode());
// This updates only this field in the document
field->Update();

◆ GetType()

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

◆ Is()

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

◆ set_IsDirty()

void Aspose::Words::Fields::FieldChar::set_IsDirty ( bool  value)

◆ set_IsLocked()

void Aspose::Words::Fields::FieldChar::set_IsLocked ( bool  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Fields::FieldChar::Type ( )
static
@ FieldDate
Specifies the DATE field.