TX Text Control Insiders' Tips: 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…


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:
|
|
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 = "";
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.
Related Posts
Create a Table of Contents in Windows Forms using C#
This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.
Official TX Text Control .NET Sample Applications Are Now Hosted on GitHub
This article gives a quick overview of the new repositories, their structure and our plans for the future.
ASP.NETJavaScriptDocument Editor
Detect Toggle Button Changes Using a MutationObserver
This article shows how to detect changes of toggle buttons in the ribbon of the web editor using a MutationObserver. The state of a toggle button in the ribbon visualizes the state of a certain…
Two Ways to Restart Numbered Lists in TX Text Control
In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…
Zoom Tricks: Disabling CTRL + MOUSE WHEEL and More
This article shows how to disable CTRL + MOUSE WHEEL, implement zooming with keyboard and reset the zoom factor to its default value.