TX Text Control .NET Server

Image Class

Class
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll
Inherits
  1. FrameBase
  2. Image

Description

An instance of the Image class represents an image in a Text Control document. The TextControl class has several events that inform about different occurrences.

Syntax

public class Image : FrameBase

Examples

The following example inserts a new image into the document, which will be treated as a character. The image's size will be reduced to 75% and it will not be sizeable:

TXTextControl.Image myImage = new TXTextControl.Image();
myImage.Sizeable = false;
myImage.HorizontalScaling = 75;
myImage.VerticalScaling = 75;

textControl1.Images.Add(myImage, -1);

The following example inserts and configures a named, accessible company logo.

TXTextControl.Image image = new() { FileName = @"Images\company-logo.png", Name = "CompanyLogo" };
textControl.Images.Add(image, -1);
textControl.Save("report-with-logo.docx", StreamType.WordprocessingML);

Members

Constructors

ConstructorDescription
ImageInitializes a new instance of the Image class.

Properties

PropertyDescription
AlignmentGets or sets the frame's horizontal alignment when it is anchored to a paragraph. (Inherited from FrameBase.)
BoundsGets the frame's bounding rectangle relative to the upper left corner of the document. (Inherited from FrameBase.)
DescriptiveTextGets or sets a descriptive text for the frame. An empty string indicates that the frame has no such text. An empty string can also be used to delete a previously set text. (Inherited from FrameBase.)
ExportCompressionQualitySets a value between 1 and 100, which is the quality of a lossy data compression used if this image is saved. It is only used if the image data is compressed with a lossy compression algorithm. A value of 100 indicates the maximum quality, a value of 1 indicates the minimum quality. If this property is set to zero, which is the default value, Text Control uses the quality value set with the SaveSettings.ImageCompressionQuality property or a compression specific default value.
ExportFileNameGets or sets the file name of an image used, if a Text Control document is saved. An empty string indicates that no export filename has currently be specified for the image. In this case either the original or a constructed filename is used. A filename is constructed in the following form: <document_filename>_<number>.<extension>
ExportFilterIndexGets or sets the format used if an image is saved. This is the number of the filter in the string returned through the ImageCollection.ExportFilters property, beginning with number one. If the ImageCollection.ExportFilters property is used to initialize the FileDialog.Filter property of a Framework dialog, the FileDialog.FilterIndex property can be used as value for this property. A value of zero indicates that no export format has currently be specified for the image. In this case the original format is used that can be obtained with the Image.FilterIndex property. The technical article Loading and Saving Images describes how images can be loaded and saved.
ExportMaxResolutionGets or sets the maximum resolution in dots per inch used if this image is saved. If the image's resolution is larger than this property's value, it is reduced; otherwise, it is not changed. If this property's value is zero, which is the default value, Text Control uses the maximum resolution set with the SaveSettings.ImageMaxResolution property or the image's default resolution.
FileNameGets or sets the corresponding file name and path from which an inserted image is loaded.
FilterIndexGets or sets the format used, if an image is inserted. This is the number of the filter in the string returned through the ImageCollection.ImportFilters property, beginning with number one. If the ImageCollection.ImportFilters property is used to initialize the FileDialog.Filter property of a Framework dialog, the FileDialog.FilterIndex property can be used as value for this property. The technical article Loading and Saving Images describes how images can be loaded and saved.
HorizontalScalingGets or sets an images's horizontal scaling factor in percent.
IDGets or sets an identifier for the frame. It must be a one-based value. A value of zero indicates that the image, text frame, chart, barcode or drawing has no identifier. Zero can also be used to delete a previously set identifier. (Inherited from FrameBase.)
InsertionModeGets or sets a value determining whether the frame is treated as a single character or the document's text either flows around or overwrites the frame. If the document's text flows around or overwrites the frame, this property also determines whether the image, text frame, chart, barcode or drawing is moved with the text or fixed positioned on a page. (Inherited from FrameBase.)
InsertionMode(Only for compatibility) Gets or sets a value determining whether an image is treated as a single character or the document's text either flows around or overwrites the image. If the document's text flows around or overwrites the image, this property also determines whether the image is moved with the text or is fixed positioned on a page.
LocationGets or sets, in twips, the frame's current location. If the image, text frame, chart, barcode or drawing is anchored to a paragraph, the location is relative to the paragraph. Otherwise, it is relative to the document. If the frame has a horizontal alignment or if it is inserted inline, this property returns zero. This property cannot be set for images, text frames, charts, barcodes or drawings which are inserted inline. (Inherited from FrameBase.)
MoveableDetermines whether a frame can be moved in the document at run time with the built-in mouse interface. (Inherited from FrameBase.)
NameGets or sets a name for the frame. An empty string indicates that the frame has no name. An empty string can also be used to delete a previously set name. (Inherited from FrameBase.)
SaveModeDetermines whether the image is stored through its data or through its file reference. By default an image is stored through a file reference if a file reference exists. Otherwise, if the image has been pasted from the clipboard, it is stored with its complete binary data.
SizeGets or sets the frame's size in twips. For images this property is read only. (Inherited from FrameBase.)
SizeableDetermines whether the frame can be resized at run time with the built-in mouse interface. (Inherited from FrameBase.)
TextDistancesGets or sets the distances, in twips, between the frame and the document's text. The property's value is an array of four variables specifying the distances in the following order: left, top, right and bottom. If a value is set to -1, it is not changed. (Inherited from FrameBase.)
TextPositionRead only. Gets the frame's character position in the document's text (one-based). (Inherited from FrameBase.)
VerticalScalingGets or sets an images's vertical scaling factor in percent.

Methods

MethodDescription
ChangeZOrderChanges the frame's z-order. (Inherited from FrameBase.)

Further Reading