TX Text Control .NET for Windows Forms Documentation

Loading and Saving Images

TX Text Control can load images saved with the following image formats:

  • FilterIndex 1: Windows Bitmap (.BMP)
  • FilterIndex 2: Tagged Image Format (.TIF)
  • FilterIndex 3: Windows Metafile (.WMF)
  • FilterIndex 4: Portable Network Graphics (.PNG)
  • FilterIndex 5: JPEG File Interchange Format (.JPG, .JPEG)
  • FilterIndex 6: Graphics Interchange Format (.GIF)

If an image has been added to a document with one of the ImageCollection.Add methods and this document is saved, a reference to the image file is saved. This reference is the image's file name including its absolute path on the file system. If such a document is loaded and the image to where the saved file reference points cannot be found, a rectangle with the image's size and a text string with the file name is displayed. The LoadSettings.ImageSearchPath property determines an additional path where to find images.

Images which are pasted from the clipboard have no file reference, therefore these images are saved in a document with their binary data. By default TX Text Control saves the image's binary data in its original file format.

Alternatively, a programmer can specify with the SaveSettings.ImageSaveMode or with the Image.SaveMode property whether images are saved through a file reference or with their binary data. The SaveSettings.ImageSaveMode property determines this for all images of the document and the Image.SaveMode property determines it for a certain image. If ImageSaveMode.SaveAsFileReference is specified for an image and a file for this image does not exist, a new file is created.

The SaveSettings.ImageExportFilterIndex and the Image.ExportFilterIndex properties can be used to save images in another than their original format. The SaveSettings.ImageExportFilterIndex property determines the export format for all images of the document and the Image.ExportFilterIndex property determines the export format for a certain image. TX Text Control supports the following formats to export images:

  • ExportFilterIndex 1: Windows Bitmap (.BMP)
  • ExportFilterIndex 2: Windows Metafile (.WMF)
  • ExportFilterIndex 3: Portable Network Graphics (.PNG)
  • ExportFilterIndex 4: JPEG File Interchange Format (.JPG, .JPEG)

If an export format has been specified and a text filter does not support this format, the image is stored in the default format of the text filter. The following lists the image formats supported by each text filter. The first format (in bold) is the default format, used when the specified format is not possible:

  • RTF Format (Rich Text Format): WMF, BMP, PNG, JPG
  • Microsoft Word Format (.DOC version): WMF, BMP, PNG, JPG
  • Microsoft Word Format (Office Open XML version): PNG, WMF, BMP, JPG, GIF
  • HTML Format (Hypertext Markup Language): PNG, JPEG, GIF
  • Adobe Portable Document Format (PDF): BMP, JPG
  • TX Text Control Format: WMF, BMP, PNG, JPG, GIF

If images are exported in another format, either the binary data is embedded in the document or new files are created and references to these files are embedded in the document. TX Text Control creates these files with the following rules:

  • The SaveSettings.ImageSavePath property determines the location on the file system where the image files are created.
  • If the SaveSettings.ImageSavePath property has not been set, TX Text Control creates a sub-directory of the directory where the text document is stored. The name of this directory has the same name as the text document and _Images is appended. For example if the text document is c:\temp\sample.rtf, the name of the sub-directory is c:\temp\sample_Images\.
  • The image's filename is determined through the Image.ExportFileName property or can be set through the built-in TextControl.ImageAttributesDialog dialog box by the end-user.
  • If an export filename has not been specified, TX Text Control uses the original filename and exchanges the extension according to the exported format.
  • If a filename does not exist, TX Text Control uses the text document's filename and appends a number. For the example above, if the export format is Windows Bitmap, the images' filenames are sample_1.bmp, sample_2.bmp and so on.
 
 
 

Products

Support

Downloads

Corporate

Buy Now