We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

InsertAfter/Before Column

Hi, I want (using c#) to copy a specific table column with ALL its informations : bookmarks in cells, text content of cells, cell format (font, color etc…) and the cloned column width
And then insert/paste it elsewhere in the same table (before or after another existing column).

How can I handle that ?
Can you provide a code sample to do that ?
Many thanks!

@Zan135 there is no concept of a column in MS Word or Aspose.Words. By design, table rows in are completely independent and the base properties and operations are only contained on rows and cells of the table. For your scenario you can use the following code, and if you want to know more about how to work with Rows and “Columns” you can do it following this link:

string dataDir = @"C:\Temp\";
string fileName = "input.docx";
Document doc = new Document(dataDir + fileName);
Document clonDoc = (Document)doc.Clone(true);

int copyCol = 1;
int afterCol = 2;
Table inTable = (Table)clonDoc.GetChildNodes(NodeType.Table, true).FirstOrDefault();

foreach (Row row in inTable.Rows)
    Cell clonedCell = (Cell)row.Cells[copyCol].Clone(true);
    row.InsertAfter(clonedCell, row.Cells[afterCol]);