TX Text Control tables

Using tables in a document can be a powerful tool to structure data, create flexible lists like in reports or to align and format text.

In contrast to other rich edit controls, TX Text Control's implementation is feature-complete:

  • Unlimited level nested tables
  • Unlimited repeating table row headers
  • Splitting cells (vertical and horizontal)
  • Merging cells (vertical and horizontal)
  • Keep content together at page breaks
  • Colored table borders and adjustable widths
  • Cell background color
  • Store data in a table cell
  • Powerful table settings dialog
  • MS Word compatible

This article is a link and article collection of the most helpful samples and tricks to get most out of this helpful feature.

Inserting a Page Break in the Middle of a Table

When pressing CTRL-ENTER while the input position is in a table, a page break is inserted automatically. To simulate this behaviour programmatically, you need to split the table first in order to insert a page break using the Selection class:

textControl1.Tables.GetItem().Split(TXTextControl.TableAddPosition.After);
textControl1.Selection.Text = "\f";

How to Format Selected Table Cells

The shipped dialog box can be used to modify the cell formatting of selected table cells. This following article shows how to format selected cells using the API instead of the dialog box:

Sample code: How to format selected table cells

How to Clone a Table Row

This article shows how to clone a specific table row without adding a new table row and copying the cell's content. The solution is quite easy. You can simply select the complete table row in order to save the row to memory using Selection.Save. On loading it again, the new table row will be added at the current input position. Same results, but much easier. Here is the full article:

How to clone a table row using TX Text Control .NET for Windows Forms

Converting a Table to Text

Thanks to TX Text Control's easy-to-use Table and TableCell classes, converting a table into normal text is quite easy to solve. The following article shows how to convert every 1-dimensional (not nested) table to normal text.

TX Text Control .NET for Windows Forms: Converting a table to text

Bound Tables: A Class to Fill and Format Tables Easily

TX Text Control offers a very powerful set of features to insert and manipulate tables. Every table cell can be formatted using the TableCell class. This sample introduces a class that can be created with a DataTable in it's constructor. The table adapts the structure of the table automatically and populates it's rows with the content from a database.

Bound tables: A class to fill and format tables easily

If you are looking for different samples or if you are having additional requirements, feel free to request a sample application.