שולחן מפוצל

Contents
[ ]

שולחן, מיוצג ב Aspose.Words Document Object Model, מורכב שורות ותאים עצמאיים, מה שהופך את זה קל לפצל שולחן.

כדי לתמרן שולחן כדי לחלק אותו לשני שולחנות, אנחנו רק צריכים להעביר כמה שורות מהשולחן המקורי אל החדש. כדי לעשות זאת, עלינו לבחור את השורה שבה אנו רוצים לחלק את השולחן.

אנו יכולים ליצור שני שולחנות מהשולחן המקורי על ידי ביצוע שלבים פשוטים אלה:

1.1 1. צור שיבוט של השולחן מבלי לשכט את הילדים כדי לשמור על שורות העבר ולהכניס אותם לאחר השולחן המקורי 2. החל מהשורה המפורטת, להעביר את כל השורות הבאות לשולחן השני

לדוגמה הקוד הבא מראה כיצד לחלק שולחן לשני שולחנות בשורה מסוימת:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git.
Document doc = new Document(MyDir + "Tables.docx");
Table firstTable = (Table) doc.GetChild(NodeType.Table, 0, true);
// We will split the table at the third row (inclusive).
Row row = firstTable.Rows[2];
// Create a new container for the split table.
Table table = (Table) firstTable.Clone(false);
// Insert the container after the original.
firstTable.ParentNode.InsertAfter(table, firstTable);
// Add a buffer paragraph to ensure the tables stay apart.
firstTable.ParentNode.InsertAfter(new Paragraph(doc), firstTable);
Row currentRow;
do
{
currentRow = firstTable.LastRow;
table.PrependChild(currentRow);
} while (currentRow != row);
doc.Save(ArtifactsDir + "WorkingWithTables.SplitTable.docx");
view raw split-table.cs hosted with ❤ by GitHub