Products Technologies Demo Docs Blog Support Company

Quick Tip: Merging Cells in Tables

Cell merging is a very easy task using TX Text Control. The method MergeCells of the Table object merges all selected table cells in a table. In order to select the desired table cells, the Select method can be used. Adjacent cells can be merged horizontally, vertically and both: Horizontal: Vertical: Block: The following code shows how to use the Select method to select a block of cells from row 1 to row 2 and column 2 to column 3:

Quick Tip: Merging Cells in Tables

Cell merging is a very easy task using TX Text Control. The method MergeCells of the Table object merges all selected table cells in a table.

In order to select the desired table cells, the Select method can be used. Adjacent cells can be merged horizontally, vertically and both:

Horizontal:

Quick tip: Merging cells in tables

Vertical:

Quick tip: Merging cells in tables

Block:

Quick tip: Merging cells in tables

The following code shows how to use the Select method to select a block of cells from row 1 to row 2 and column 2 to column 3:

textControl1.Tables.Add(3, 6, 10);

Table table = textControl1.Tables.GetItem(10);

table.Select(1, 2, 2, 3);
table.MergeCells();

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Also See

This post references the following in the documentation:

  • TXTextControl.Table Class
  • TXTextControl.Table.MergeCells Method
  • TXTextControl.Table.Select Method

Windows Forms

Text Control combines the power of a reporting tool and an easy-to-use WYSIWYG word processor - fully programmable and embeddable in your Windows Forms application. TX Text Control .NET for Windows Forms is a royalty-free, fully programmable rich edit control that offers developers a broad range of word processing features in a reusable component for Visual Studio.

See Windows Forms products

Related Posts

ASP.NETWindows FormsWPF

Inserting MergeBlocks with the DataSourceManager and Applying Table Styles in C#

This article shows how to insert MergeBlocks with the DataSourceManager and how to apply table styles to those tables. The article uses the DocumentServer class to insert MergeBlocks with the…


ASP.NETWindows FormsWPF

Useful Tricks for Working with Tables

When you are working with complex and long tables, it can be useful to know if a table is broken up across multiple pages. These code snippets will help you with various table related tasks.


ASP.NETWindows FormsWPF

Generating Hierarchical Tables from JSON Data in .NET C#

Using TX Text Control, you can generate complex hierarchical tables directly from JSON data. This article explains the code and logic behind it.


ASP.NETWindows FormsWPF

Extension Method: Converting Tables to Tabs in C#

When you export documents to formats that don't support tables, such as ANSI text, you can convert those tables to tabs. This article describes how to convert a table object to tabs using a C#…


ASP.NETWindows FormsWPF

Formatting Numbers in Table Cells

Table cell text can be interpreted as plain text or as a number with an associated number format. This article explains how to use this format and gives examples for various string formatters.