Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
A table, represented in the Aspose.Words Document Object Model, is made up of independent rows and cells, making it easy to split a table.
To manipulate a table to split it into two tables, we just need to move some of the rows from the original table to the new one. To do this, we need to pick the row by which we want to split the table.
We can create two tables from the original table by following these simple steps:
The following code example shows how to split a table into two tables on a specific row:
Q: How do I split a table at a specific row using Aspose.Words for C++?
A: Create a clone of the original table without its child rows (table->Clone(false)), insert the clone after the original, then move all rows starting from the split row to the new table using Table::get_Rows()->RemoveAt() and Table::AppendChild(row). This preserves the original formatting while separating the rows into a new table.
Q: Will the cell formatting (widths, borders, shading) be retained after splitting?
A: Yes. Cloning the table without children copies the table’s formatting, column widths, and style definitions. When you move rows to the cloned table, each row keeps its own cell formatting, so the appearance of both tables remains unchanged.
Q: Can I split a table into more than two tables?
A: Absolutely. Repeat the split process for each desired split point: clone the current table, insert the clone, and move the appropriate rows. Each iteration creates an additional independent table.
Q: What should I do if the split row is the first or last row of the table?
A: If the split row is the first row, the original table will become empty; you may remove it with Node::Remove(). If the split row is the last row, the new table will contain no rows, so you can skip inserting the clone or delete it after the operation.
Q: How can I split a table that is nested inside another table cell?
A: Retrieve the nested table via Cell::GetChildNodes(NodeType::Table, true) and apply the same cloning and row‑moving logic. Insert the new table into the same parent node (the cell) using InsertAfter to keep the document structure intact.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.