שולחן מפוצל

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-Python-via-.NET.git.
doc = aw.Document(MY_DIR + "Tables.docx")
first_table = doc.get_child(aw.NodeType.TABLE, 0, True).as_table()
# We will split the table at the third row (inclusive).
row = first_table.rows[2]
# Create a new container for the split table.
table = first_table.clone(False).as_table()
# Insert the container after the original.
first_table.parent_node.insert_after(table, first_table)
# Add a buffer paragraph to ensure the tables stay apart.
first_table.parent_node.insert_after(aw.Paragraph(doc), first_table)
while True:
current_row = first_table.last_row
table.prepend_child(current_row)
if current_row == row:
break
doc.save(ARTIFACTS_DIR + "WorkingWithTables.split_table.docx")
view raw split-table.py hosted with ❤ by GitHub