Products Technologies Demo Docs Blog Support Company

ID and Name Properties for Images and Text Frames

One of the most commonly requested features since the release of version 15.0 is the possibility to store additional information for images and text frames. Version 15.1 implements an ID and a Name property for these frame-based objects. These properties helps you to find an image or frame based on a specific name. In previous versions, there was no way to get a specific text frame out of the document, though it was possible to iterate through all frames using it's collection. But now, you…

ID and Name Properties for Images and Text Frames

One of the most commonly requested features since the release of version 15.0 is the possibility to store additional information for images and text frames.

Version 15.1 implements an ID and a Name property for these frame-based objects. These properties helps you to find an image or frame based on a specific name. In previous versions, there was no way to get a specific text frame out of the document, though it was possible to iterate through all frames using it's collection. But now, you can use the GetItem method to retrieve a specific text frame.

Consider the following scenario: A text frame is inserted into a template that contains the recipient's address on a letter. During the merge process, you simply need to find that text frame based on it's Name in order to update the text.

The Name property is also compatible to other supported formats like DOCX, DOC or RTF and will be maintained after saving to these formats.

The following code inserts a text frame with the name recipient. It shows that the Name property is maintained after saving as DOCX. Using the GetItem method, the text frame can be retrieved in order to update it's text.

// [C#]
TextFrame frame = new TextFrame(new Size(2000, 2000));
frame.Name = "recipient";

textControl1.TextFrames.Add(frame, -1);

// save as DOCX and reload to prove that the Name is maintained
byte[] data;
textControl1.Save(out data, BinaryStreamType.WordprocessingML);
textControl1.ResetContents();
textControl1.Load(data, BinaryStreamType.WordprocessingML);

textControl1.TextFrames.GetItem("recipient").Selection.Text = "TX Text Control";

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

Image.NETSample

Inserting Images from Memory

Recently, a new sample has been released in the source code library. TX Text Control offers various functions to insert images from physical files in many supported formats. Sometimes, however, it…


ImageRelease

Image Improvements in Version 12.0

Recently, we published an overview of the new image improvements that come with TX Text Control 12.0. This overview helps you learn more about the new image wrapping styles, the user interface and…


ImageSample

Changing the Image Format Order in the 'insert Image Dialog'

I just got an interesting support question: "How can I change the order of the image formats in the dialog box that is opended by calling the ImageCollection.Add method?" The dialog reads all…


Image.NETSample

Embedding Images in Various Formats

We are frequently asked why the filesize of documents containing images (BMP and WMF) grows when they are exported to Microsoft Word or RTF formats. The answer is quite simple: Images might be…