search/mag_sel search/close
Aspose::Words::Fields::FieldHyperlink Class Reference

Implements the HYPERLINK field.

Examples

Shows how to use HYPERLINK fields to link to documents in the local file system.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document and then place the cursor at the specified bookmark.
field->set_Address(MyDir + u"Bookmarks.docx");
field->set_SubAddress(u"MyBookmark3");
field->set_ScreenTip(String(u"Open ") + field->get_Address() + u" on bookmark " + field->get_SubAddress() + u" in a new window");
builder->Writeln();
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document, and automatically scroll down to the specified iframe.
field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
field->set_Address(MyDir + u"Iframes.html");
field->set_ScreenTip(String(u"Open ") + field->get_Address());
field->set_Target(u"iframe_3");
field->set_OpenInNewWindow(true);
field->set_IsImageMap(false);
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.HYPERLINK.docx");

#include <Aspose.Words.Cpp/Fields/FieldHyperlink.h>

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

Public Member Functions

String get_Address ()
 Gets or sets a location where this hyperlink jumps. More...
 
bool get_IsImageMap ()
 Gets or sets whether to append coordinates to the hyperlink for a server-side image map. More...
 
bool get_OpenInNewWindow ()
 Gets or sets whether to open the destination site in a new web browser window. More...
 
String get_ScreenTip ()
 Gets or sets the ScreenTip text for the hyperlink. More...
 
String get_SubAddress ()
 Gets or sets a location in the file, such as a bookmark, where this hyperlink jumps. More...
 
String get_Target ()
 Gets or sets the target to which the link should be redirected. More...
 
SharedPtr< Aspose::Words::Fields::IFieldResultFormatApplier > GetFormatApplier () override
 
SharedPtr< InlineGetSourceNode () override
 
FieldSwitchType GetSwitchType (String switchName) override
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_Address (String value)
 Setter for get_Address. More...
 
void set_IsImageMap (bool value)
 Setter for get_IsImageMap. More...
 
void set_OpenInNewWindow (bool value)
 Setter for get_OpenInNewWindow. More...
 
void set_ScreenTip (String value)
 Setter for get_ScreenTip. More...
 
void set_SubAddress (String value)
 Setter for get_SubAddress. More...
 
void set_Target (String value)
 Setter for get_Target. More...
 
- Public Member Functions inherited from Field
String get_DisplayResult ()
 Gets the text that represents the displayed field result. More...
 
SharedPtr< FieldEndget_End () const
 Gets the node that represents the field end. More...
 
SharedPtr< FieldEndget_FieldEnd () const
 Gets the node that represents the field end. More...
 
SharedPtr< FieldStartget_FieldStart () const
 Gets the node that represents the start of the field. More...
 
SharedPtr< FieldFormatget_Format ()
 Gets a FieldFormat object that provides typed access to field's formatting. More...
 
bool get_IsDirty ()
 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 ()
 Gets or sets whether the field is locked (should not recalculate its result). More...
 
int32_t get_LocaleId ()
 Gets or sets the LCID of the field. More...
 
String get_Result ()
 Gets or sets text that is between the field separator and field end. More...
 
SharedPtr< FieldSeparatorget_Separator ()
 Gets the node that represents the field separator. Can be null. More...
 
SharedPtr< FieldStartget_Start () const
 Gets the node that represents the start of the field. More...
 
virtual FieldType get_Type ()
 Gets the Microsoft Word field type. More...
 
String GetFieldCode ()
 Returns text between field start and field separator (or field end if there is no separator). Both field code and field result of child fields are included. More...
 
String GetFieldCode (bool includeChildFieldCodes)
 Returns text between field start and field separator (or field end if there is no separator). More...
 
SharedPtr< NodeRemove ()
 Removes the field from the document. Returns a node right after the field. If the field's end is the last child of its parent node, returns its parent paragraph. If the field is already removed, returns null. More...
 
void set_IsDirty (bool value)
 Setter for get_IsDirty. More...
 
void set_IsLocked (bool value)
 Setter for get_IsLocked. More...
 
void set_LocaleId (int32_t value)
 Setter for get_LocaleId. More...
 
void set_Result (String value)
 Setter for get_Result. More...
 
bool Unlink ()
 Performs the field unlink. More...
 
void Update ()
 Performs the field update. Throws if the field is being updated already. More...
 
void Update (bool ignoreMergeFormat)
 Performs a field update. Throws if the field is being updated already. More...
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from Field
static const TypeInfoType ()
 

Member Function Documentation

◆ get_Address()

System::String Aspose::Words::Fields::FieldHyperlink::get_Address ( )

Gets or sets a location where this hyperlink jumps.

Examples

Shows how to use HYPERLINK fields to link to documents in the local file system.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document and then place the cursor at the specified bookmark.
field->set_Address(MyDir + u"Bookmarks.docx");
field->set_SubAddress(u"MyBookmark3");
field->set_ScreenTip(String(u"Open ") + field->get_Address() + u" on bookmark " + field->get_SubAddress() + u" in a new window");
builder->Writeln();
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document, and automatically scroll down to the specified iframe.
field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
field->set_Address(MyDir + u"Iframes.html");
field->set_ScreenTip(String(u"Open ") + field->get_Address());
field->set_Target(u"iframe_3");
field->set_OpenInNewWindow(true);
field->set_IsImageMap(false);
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.HYPERLINK.docx");

◆ get_IsImageMap()

bool Aspose::Words::Fields::FieldHyperlink::get_IsImageMap ( )

Gets or sets whether to append coordinates to the hyperlink for a server-side image map.

Examples

Shows how to use HYPERLINK fields to link to documents in the local file system.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document and then place the cursor at the specified bookmark.
field->set_Address(MyDir + u"Bookmarks.docx");
field->set_SubAddress(u"MyBookmark3");
field->set_ScreenTip(String(u"Open ") + field->get_Address() + u" on bookmark " + field->get_SubAddress() + u" in a new window");
builder->Writeln();
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document, and automatically scroll down to the specified iframe.
field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
field->set_Address(MyDir + u"Iframes.html");
field->set_ScreenTip(String(u"Open ") + field->get_Address());
field->set_Target(u"iframe_3");
field->set_OpenInNewWindow(true);
field->set_IsImageMap(false);
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.HYPERLINK.docx");

◆ get_OpenInNewWindow()

bool Aspose::Words::Fields::FieldHyperlink::get_OpenInNewWindow ( )

Gets or sets whether to open the destination site in a new web browser window.

Examples

Shows how to use HYPERLINK fields to link to documents in the local file system.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document and then place the cursor at the specified bookmark.
field->set_Address(MyDir + u"Bookmarks.docx");
field->set_SubAddress(u"MyBookmark3");
field->set_ScreenTip(String(u"Open ") + field->get_Address() + u" on bookmark " + field->get_SubAddress() + u" in a new window");
builder->Writeln();
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document, and automatically scroll down to the specified iframe.
field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
field->set_Address(MyDir + u"Iframes.html");
field->set_ScreenTip(String(u"Open ") + field->get_Address());
field->set_Target(u"iframe_3");
field->set_OpenInNewWindow(true);
field->set_IsImageMap(false);
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.HYPERLINK.docx");

◆ get_ScreenTip()

System::String Aspose::Words::Fields::FieldHyperlink::get_ScreenTip ( )

Gets or sets the ScreenTip text for the hyperlink.

Examples

Shows how to use HYPERLINK fields to link to documents in the local file system.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document and then place the cursor at the specified bookmark.
field->set_Address(MyDir + u"Bookmarks.docx");
field->set_SubAddress(u"MyBookmark3");
field->set_ScreenTip(String(u"Open ") + field->get_Address() + u" on bookmark " + field->get_SubAddress() + u" in a new window");
builder->Writeln();
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document, and automatically scroll down to the specified iframe.
field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
field->set_Address(MyDir + u"Iframes.html");
field->set_ScreenTip(String(u"Open ") + field->get_Address());
field->set_Target(u"iframe_3");
field->set_OpenInNewWindow(true);
field->set_IsImageMap(false);
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.HYPERLINK.docx");

◆ get_SubAddress()

System::String Aspose::Words::Fields::FieldHyperlink::get_SubAddress ( )

Gets or sets a location in the file, such as a bookmark, where this hyperlink jumps.

Examples

Shows how to use HYPERLINK fields to link to documents in the local file system.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document and then place the cursor at the specified bookmark.
field->set_Address(MyDir + u"Bookmarks.docx");
field->set_SubAddress(u"MyBookmark3");
field->set_ScreenTip(String(u"Open ") + field->get_Address() + u" on bookmark " + field->get_SubAddress() + u" in a new window");
builder->Writeln();
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document, and automatically scroll down to the specified iframe.
field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
field->set_Address(MyDir + u"Iframes.html");
field->set_ScreenTip(String(u"Open ") + field->get_Address());
field->set_Target(u"iframe_3");
field->set_OpenInNewWindow(true);
field->set_IsImageMap(false);
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.HYPERLINK.docx");

◆ get_Target()

System::String Aspose::Words::Fields::FieldHyperlink::get_Target ( )

Gets or sets the target to which the link should be redirected.

Examples

Shows how to use HYPERLINK fields to link to documents in the local file system.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
auto field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document and then place the cursor at the specified bookmark.
field->set_Address(MyDir + u"Bookmarks.docx");
field->set_SubAddress(u"MyBookmark3");
field->set_ScreenTip(String(u"Open ") + field->get_Address() + u" on bookmark " + field->get_SubAddress() + u" in a new window");
builder->Writeln();
// When we click this HYPERLINK field in Microsoft Word,
// it will open the linked document, and automatically scroll down to the specified iframe.
field = System::DynamicCast<FieldHyperlink>(builder->InsertField(FieldType::FieldHyperlink, true));
field->set_Address(MyDir + u"Iframes.html");
field->set_ScreenTip(String(u"Open ") + field->get_Address());
field->set_Target(u"iframe_3");
field->set_OpenInNewWindow(true);
field->set_IsImageMap(false);
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.HYPERLINK.docx");

◆ GetFormatApplier()

System::SharedPtr<Aspose::Words::Fields::IFieldResultFormatApplier> Aspose::Words::Fields::FieldHyperlink::GetFormatApplier ( )
override

◆ GetSourceNode()

System::SharedPtr<Aspose::Words::Inline> Aspose::Words::Fields::FieldHyperlink::GetSourceNode ( )
override

◆ GetSwitchType()

Aspose::Words::Fields::FieldSwitchType Aspose::Words::Fields::FieldHyperlink::GetSwitchType ( System::String  switchName)
override

◆ GetType()

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

Reimplemented from Aspose::Words::Fields::Field.

◆ Is()

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

Reimplemented from Aspose::Words::Fields::Field.

◆ set_Address()

void Aspose::Words::Fields::FieldHyperlink::set_Address ( System::String  value)

◆ set_IsImageMap()

void Aspose::Words::Fields::FieldHyperlink::set_IsImageMap ( bool  value)

◆ set_OpenInNewWindow()

void Aspose::Words::Fields::FieldHyperlink::set_OpenInNewWindow ( bool  value)

◆ set_ScreenTip()

void Aspose::Words::Fields::FieldHyperlink::set_ScreenTip ( System::String  value)

◆ set_SubAddress()

void Aspose::Words::Fields::FieldHyperlink::set_SubAddress ( System::String  value)

◆ set_Target()

void Aspose::Words::Fields::FieldHyperlink::set_Target ( System::String  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Fields::FieldHyperlink::Type ( )
static