瀏覽代碼

Fixed a bug which resulted in Table.rows being null.

master
coffeycathal_cp 15 年之前
父節點
當前提交
b5aa4ee366
共有 2 個檔案被更改,包括 21 行新增2 行删除
  1. 2
    2
      DocX/Table.cs
  2. 19
    0
      UnitTests/UnitTest1.cs

+ 2
- 2
DocX/Table.cs 查看文件

@@ -836,9 +836,9 @@ namespace Novacode
/// </example>
public void InsertColumn(int index)
{
if (rows.Count > 0)
if (Rows.Count > 0)
{
foreach (Row r in rows)
foreach (Row r in Rows)
{
if(columnCount == index)
r.Cells[index - 1].Xml.AddAfterSelf(new XElement(XName.Get("tc", DocX.w.NamespaceName), new XElement(XName.Get("p", DocX.w.NamespaceName))));

+ 19
- 0
UnitTests/UnitTest1.cs 查看文件

@@ -992,6 +992,25 @@ namespace UnitTests
File.Delete(file_temp);
}
[TestMethod]
public void Test_Table_InsertRow()
{
using (DocX document = DocX.Create(directory_documents + "Tables2.docx"))
{
// Add a Table to a document.
Table t = document.AddTable(2, 2);
t.Design = TableDesign.TableGrid;
// Insert the Table into the main section of the document.
Table t1 = document.InsertTable(t);
t1.InsertRow();
t1.InsertColumn();
// Save the document.
document.Save();
}
}
[TestMethod]
public void Test_Document_ApplyTemplate()
{

Loading…
取消
儲存