TX Text Control ActiveX

Working With Files

Topic

TX Text Control works with eight file formats, from its own native format for document files to RTF, HTML, XML, Word and plain text, and it exports PDF. Which one you choose decides what else can go into the file: the exchange formats hold the contents of one TXTextControl, while the native format can carry a file header or the contents of several controls.

Supported File Formats

FormatUsed for
Native TX Text Control formatStoring data in document files, the format you normally use
Rich Text Format (RTF)Exchanging formatted text with other applications
HTMLLoading and saving HTML documents
XMLLoading and saving XML documents
Microsoft Word (.docx)Loading and saving Word documents
Microsoft Word 97-2003 (.doc)Loading and saving Word 97-2003 documents
Unformatted textText in ANSI or Unicode format
Adobe PDFExporting documents only

Load and Save a Format

To use RTF, HTML, Word or unformatted text, pass the format you want as a parameter of the Load or Save method. The reference pages of both methods list the format identifiers.

With RTF, HTML, Word and unformatted text, a file holds the contents of a single TXTextControl: you read them from the file or write them to it, and nothing else.

In the TXWords sample, the user chooses the format in the Save as type list of the Save As dialog box:

The Save As dialog box of the TXWords sample with the Save as type list open, offering TX Words Format, Rich Text Format, Plain Text Format (ANSI), Plain Text Format (Unicode), Microsoft Word Format and Hyper Text Markup Language, in the look of TX Text Control 10

Combine Data in One File

The native file format goes further:

  • A file header. You can write a header of your own to the file before you save the TXTextControl data.
  • Several controls. You can write the contents of several TXTextControl controls to one file.

Next Steps

  • Mail Merge: the sample program writes the contents of TXTextControl and other data to a single file.
  • A Word Processor: the TXWords sample writes a file header before the TXTextControl data and uses RTF, HTML, Word and unformatted text.
  • File Drag and Drop: loading a file that the user drops on the control.
  • PDF Export: creating PDF documents.