Products Technologies Demo Docs Blog Support Company

How to Clone a Table Row Using TX Text Control .NET for Windows Forms

I found this solution by reviewing our recent support cases. A user wanted to know 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. The following code can be used to clone the table row at the current…

How to Clone a Table Row Using TX Text Control .NET for Windows Forms

I found this solution by reviewing our recent support cases. A user wanted to know 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.

The following code can be used to clone the table row at the current input position:

// [C#]
private bool CloneTableRow()
{
 textControl1.Selection.Length = 0;

 TXTextControl.Table curTable = textControl1.Tables.GetItem();
 if (curTable == null)
  return false;

 curTable.Rows.GetItem().Select();

 byte[] rowData;
 textControl1.Selection.Save(out rowData,
              TXTextControl.BinaryStreamType.InternalUnicodeFormat);
 textControl1.Selection.Length = 0;
 textControl1.Selection.Load(rowData,
              TXTextControl.BinaryStreamType.InternalUnicodeFormat);

 return true;
}

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

ASP.NETASP.NET CorePDF

Why Table Control in Templates is Important for Professional PDF Creation in C#

Controlling how tables behave at page breaks is an important factor in creating professional-looking documents. This article discusses the importance of table control in templates for PDF generation.


ASP.NETWindows FormsASP.NET Core

Splitting Tables at Bookmark Positions and Cloning Table Headers

This article shows how to split tables at bookmark positions and how to clone table headers in TX Text Control .NET for Windows Forms and TX Text Control .NET Server.


ASP.NETWindows FormsExcel

Loading and Processing Excel XLSX Spreadsheet Tables into TX Text Control…

TX Text Control provides a powerful API to load and process Excel spreadsheet tables in .NET applications. This article shows how to load an Excel file and process the tables using TX Text Control…


AngularASP.NETASP.NET Core

Creating Advanced Tables in PDF and DOCX Documents with C#

This article shows how to create advanced tables in PDF and DOCX documents using the TX Text Control .NET for ASP.NET Server component. This article shows how to create tables from scratch,…


ASP.NETWindows FormsTab Stops

Text to Table and Table to Text in TX Text Control and C#

TX Text Control provides powerful table features and also full access to text formatting which can be used to create tables from text and vice versa. This article shows how to convert text to…