簡體   English   中英

如何使用Novacode DocX在表上設置“保留下一個”屬性?

[英]How to set “keep with next” property on a table using Novacode DocX?

在Word中,在“段落”>“換行和分頁符”下有一個“繼續保存”的屬性。 我想知道是否有辦法將此屬性設置為使用Novacode DocX創建的表

是的,使用KeepWithNext(true)在表的每一行中至少設置一個單元格的段落。 如果要動態構建表,那么這很容易做到。

Novacode.Table t = doc.InsertTable(2, 3); // 2 rows; 3 columns

t.Rows[0].Cells[0].Paragraphs[0].Append("A1").KeepWithNext(true);
t.Rows[0].Cells[1].Paragraphs[0].Append("B1");
t.Rows[0].Cells[2].Paragraphs[0].Append("C1");
t.Rows[0].Cells[0].Paragraphs[0].KeepWithNext(true);

t.Rows[1].Cells[0].Paragraphs[0].Append("A2").KeepWithNext(true);
t.Rows[1].Cells[1].Paragraphs[0].Append("B2");
t.Rows[1].Cells[2].Paragraphs[0].Append("C2");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM