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

Implements the INCLUDEPICTURE field.

Examples

Shows how to insert images using IMPORT and INCLUDEPICTURE fields.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
auto fieldIncludePicture = System::DynamicCast<FieldIncludePicture>(builder->InsertField(FieldType::FieldIncludePicture, true));
fieldIncludePicture->set_SourceFullName(ImageDir + u"Transparent background logo.png");
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldIncludePicture->GetFieldCode(), u" INCLUDEPICTURE .*")->get_Success());
// Apply the PNG32.FLT filter.
fieldIncludePicture->set_GraphicFilter(u"PNG32");
fieldIncludePicture->set_IsLinked(true);
fieldIncludePicture->set_ResizeHorizontally(true);
fieldIncludePicture->set_ResizeVertically(true);
// 2 - The IMPORT field:
auto fieldImport = System::DynamicCast<FieldImport>(builder->InsertField(FieldType::FieldImport, true));
fieldImport->set_SourceFullName(ImageDir + u"Transparent background logo.png");
fieldImport->set_GraphicFilter(u"PNG32");
fieldImport->set_IsLinked(true);
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldImport->GetFieldCode(), u" IMPORT .* \\\\c PNG32 \\\\d")->get_Success());
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.IMPORT.INCLUDEPICTURE.docx");

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

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

Public Member Functions

String get_GraphicFilter ()
 Gets or sets the name of the filter for the format of the graphic that is to be inserted. More...
 
bool get_IsLinked () override
 Gets or sets whether to reduce the file size by not storing graphics data with the document. More...
 
bool get_ResizeHorizontally ()
 Gets or sets whether to resize the picture horizontally from the source. More...
 
bool get_ResizeVertically ()
 Gets or sets whether to resize the picture vertically from the source. More...
 
String get_SourceFullName () override
 Gets or sets the location of the picture using an IRI. More...
 
FieldSwitchType GetSwitchType (String switchName) override
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_GraphicFilter (String value)
 Setter for get_GraphicFilter. More...
 
void set_IsLinked (bool value)
 Setter for get_IsLinked. More...
 
void set_ResizeHorizontally (bool value)
 Setter for get_ResizeHorizontally. More...
 
void set_ResizeVertically (bool value)
 Setter for get_ResizeVertically. More...
 
void set_SourceFullName (String value)
 Setter for get_SourceFullName. 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_GraphicFilter()

System::String Aspose::Words::Fields::FieldIncludePicture::get_GraphicFilter ( )

Gets or sets the name of the filter for the format of the graphic that is to be inserted.

Examples

Shows how to insert images using IMPORT and INCLUDEPICTURE fields.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
auto fieldIncludePicture = System::DynamicCast<FieldIncludePicture>(builder->InsertField(FieldType::FieldIncludePicture, true));
fieldIncludePicture->set_SourceFullName(ImageDir + u"Transparent background logo.png");
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldIncludePicture->GetFieldCode(), u" INCLUDEPICTURE .*")->get_Success());
// Apply the PNG32.FLT filter.
fieldIncludePicture->set_GraphicFilter(u"PNG32");
fieldIncludePicture->set_IsLinked(true);
fieldIncludePicture->set_ResizeHorizontally(true);
fieldIncludePicture->set_ResizeVertically(true);
// 2 - The IMPORT field:
auto fieldImport = System::DynamicCast<FieldImport>(builder->InsertField(FieldType::FieldImport, true));
fieldImport->set_SourceFullName(ImageDir + u"Transparent background logo.png");
fieldImport->set_GraphicFilter(u"PNG32");
fieldImport->set_IsLinked(true);
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldImport->GetFieldCode(), u" IMPORT .* \\\\c PNG32 \\\\d")->get_Success());
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.IMPORT.INCLUDEPICTURE.docx");

◆ get_IsLinked()

bool Aspose::Words::Fields::FieldIncludePicture::get_IsLinked ( )
override

Gets or sets whether to reduce the file size by not storing graphics data with the document.

Examples

Shows how to insert images using IMPORT and INCLUDEPICTURE fields.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
auto fieldIncludePicture = System::DynamicCast<FieldIncludePicture>(builder->InsertField(FieldType::FieldIncludePicture, true));
fieldIncludePicture->set_SourceFullName(ImageDir + u"Transparent background logo.png");
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldIncludePicture->GetFieldCode(), u" INCLUDEPICTURE .*")->get_Success());
// Apply the PNG32.FLT filter.
fieldIncludePicture->set_GraphicFilter(u"PNG32");
fieldIncludePicture->set_IsLinked(true);
fieldIncludePicture->set_ResizeHorizontally(true);
fieldIncludePicture->set_ResizeVertically(true);
// 2 - The IMPORT field:
auto fieldImport = System::DynamicCast<FieldImport>(builder->InsertField(FieldType::FieldImport, true));
fieldImport->set_SourceFullName(ImageDir + u"Transparent background logo.png");
fieldImport->set_GraphicFilter(u"PNG32");
fieldImport->set_IsLinked(true);
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldImport->GetFieldCode(), u" IMPORT .* \\\\c PNG32 \\\\d")->get_Success());
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.IMPORT.INCLUDEPICTURE.docx");

◆ get_ResizeHorizontally()

bool Aspose::Words::Fields::FieldIncludePicture::get_ResizeHorizontally ( )

Gets or sets whether to resize the picture horizontally from the source.

Examples

Shows how to insert images using IMPORT and INCLUDEPICTURE fields.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
auto fieldIncludePicture = System::DynamicCast<FieldIncludePicture>(builder->InsertField(FieldType::FieldIncludePicture, true));
fieldIncludePicture->set_SourceFullName(ImageDir + u"Transparent background logo.png");
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldIncludePicture->GetFieldCode(), u" INCLUDEPICTURE .*")->get_Success());
// Apply the PNG32.FLT filter.
fieldIncludePicture->set_GraphicFilter(u"PNG32");
fieldIncludePicture->set_IsLinked(true);
fieldIncludePicture->set_ResizeHorizontally(true);
fieldIncludePicture->set_ResizeVertically(true);
// 2 - The IMPORT field:
auto fieldImport = System::DynamicCast<FieldImport>(builder->InsertField(FieldType::FieldImport, true));
fieldImport->set_SourceFullName(ImageDir + u"Transparent background logo.png");
fieldImport->set_GraphicFilter(u"PNG32");
fieldImport->set_IsLinked(true);
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldImport->GetFieldCode(), u" IMPORT .* \\\\c PNG32 \\\\d")->get_Success());
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.IMPORT.INCLUDEPICTURE.docx");

◆ get_ResizeVertically()

bool Aspose::Words::Fields::FieldIncludePicture::get_ResizeVertically ( )

Gets or sets whether to resize the picture vertically from the source.

Examples

Shows how to insert images using IMPORT and INCLUDEPICTURE fields.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
auto fieldIncludePicture = System::DynamicCast<FieldIncludePicture>(builder->InsertField(FieldType::FieldIncludePicture, true));
fieldIncludePicture->set_SourceFullName(ImageDir + u"Transparent background logo.png");
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldIncludePicture->GetFieldCode(), u" INCLUDEPICTURE .*")->get_Success());
// Apply the PNG32.FLT filter.
fieldIncludePicture->set_GraphicFilter(u"PNG32");
fieldIncludePicture->set_IsLinked(true);
fieldIncludePicture->set_ResizeHorizontally(true);
fieldIncludePicture->set_ResizeVertically(true);
// 2 - The IMPORT field:
auto fieldImport = System::DynamicCast<FieldImport>(builder->InsertField(FieldType::FieldImport, true));
fieldImport->set_SourceFullName(ImageDir + u"Transparent background logo.png");
fieldImport->set_GraphicFilter(u"PNG32");
fieldImport->set_IsLinked(true);
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldImport->GetFieldCode(), u" IMPORT .* \\\\c PNG32 \\\\d")->get_Success());
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.IMPORT.INCLUDEPICTURE.docx");

◆ get_SourceFullName()

System::String Aspose::Words::Fields::FieldIncludePicture::get_SourceFullName ( )
override

Gets or sets the location of the picture using an IRI.

Examples

Shows how to insert images using IMPORT and INCLUDEPICTURE fields.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
// Below are two similar field types that we can use to display images linked from the local file system.
// 1 - The INCLUDEPICTURE field:
auto fieldIncludePicture = System::DynamicCast<FieldIncludePicture>(builder->InsertField(FieldType::FieldIncludePicture, true));
fieldIncludePicture->set_SourceFullName(ImageDir + u"Transparent background logo.png");
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldIncludePicture->GetFieldCode(), u" INCLUDEPICTURE .*")->get_Success());
// Apply the PNG32.FLT filter.
fieldIncludePicture->set_GraphicFilter(u"PNG32");
fieldIncludePicture->set_IsLinked(true);
fieldIncludePicture->set_ResizeHorizontally(true);
fieldIncludePicture->set_ResizeVertically(true);
// 2 - The IMPORT field:
auto fieldImport = System::DynamicCast<FieldImport>(builder->InsertField(FieldType::FieldImport, true));
fieldImport->set_SourceFullName(ImageDir + u"Transparent background logo.png");
fieldImport->set_GraphicFilter(u"PNG32");
fieldImport->set_IsLinked(true);
ASSERT_TRUE(System::Text::RegularExpressions::Regex::Match(fieldImport->GetFieldCode(), u" IMPORT .* \\\\c PNG32 \\\\d")->get_Success());
doc->UpdateFields();
doc->Save(ArtifactsDir + u"Field.IMPORT.INCLUDEPICTURE.docx");

◆ GetSwitchType()

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

◆ GetType()

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

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

◆ Is()

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

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

◆ set_GraphicFilter()

void Aspose::Words::Fields::FieldIncludePicture::set_GraphicFilter ( System::String  value)

◆ set_IsLinked()

void Aspose::Words::Fields::FieldIncludePicture::set_IsLinked ( bool  value)

◆ set_ResizeHorizontally()

void Aspose::Words::Fields::FieldIncludePicture::set_ResizeHorizontally ( bool  value)

◆ set_ResizeVertically()

void Aspose::Words::Fields::FieldIncludePicture::set_ResizeVertically ( bool  value)

◆ set_SourceFullName()

void Aspose::Words::Fields::FieldIncludePicture::set_SourceFullName ( System::String  value)

◆ Type()

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