TX Text Control .NET Server

Image Constructor

Constructor
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK as TXTextControl.Core.dll from the private NuGet feed or Text Control Offline Packages
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll

Description

Initializes a new instance of the Image class.

Syntax

Image()

Creates an empty instance of the Image class.

public Image();

Image(string, int)

Initializes a new image from the specified image file and filter.

public Image(string fileName, int filterIndex);
ParameterDescription
fileName

Specifies the name and the path of the file from which the image is loaded.

filterIndex

Specifies the index of the filter used to load the image. It is an index in the string returned through the ImageCollection.ImportFilters property starting with 1. Possible values are:

ValueDescription
1Windows Bitmap (.BMP)
2Tagged Image Format (.TIF)
3Windows Metafile (.WMF)
4Portable Network Graphics (.PNG)
5JPEG File Interchange Format (.JPG, .JPEG)
6Graphics Interchange Format (.GIF)
7Windows Enhanced Metafile (.EMF)
8Scalable Vector Graphics (.SVG)

Image(System.Drawing.Image)

Initializes a new image from the specified System.Drawing.Image.

Only in TXTextControl.TextControl.ASP.SDK.

public Image(System.Drawing.Image image);
ParameterDescription
image

Specifies a System.Drawing.Image object which is used to initialize the TXTextControl image.

Image(MemoryStream)

Initializes a new image from the specified memory stream.

public Image(MemoryStream stream);
ParameterDescription
stream

Specifies a memory stream from which the data for the TXTextControl image is read.

Examples

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);