Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main/HPSF/SummaryInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public SummaryInformation(PropertySet ps) : base(ps)

/// <summary>
/// <para>
/// Creates a <see cref="SummaryInformation"/> instance from an <see cref="/// InputStream} in the Horrible Property Set Format.
/// Creates a <see cref="SummaryInformation"/> instance from an InputStream in the Horrible Property Set Format.
/// </para>
/// <para>
/// The constructor reads the first few bytes from the stream
Expand Down
2 changes: 1 addition & 1 deletion main/SS/UserModel/ConditionalFormattingRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public interface IConditionalFormattingRule : IDifferentialStyleProvider
/// true if conditional formatting rule processing stops when this one is true, false if not
/// </para>
/// </summary>
/// <see cref="https://support.office.com/en-us/article/Manage-conditional-formatting-rule-precedence-063cde21-516e-45ca-83f5-8e8126076249" /> Microsoft Excel help
/// <see href="https://support.office.com/en-us/article/Manage-conditional-formatting-rule-precedence-063cde21-516e-45ca-83f5-8e8126076249">Microsoft Excel help</see>
bool StopIfTrue { get; }

/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions ooxml/XWPF/Usermodel/XWPFTableCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public XWPFParagraph AddParagraph()
public void AddParagraph(XWPFParagraph p)
{
paragraphs.Add(p);
bodyElements.Add(p);
}

/**
Expand All @@ -163,8 +164,10 @@ public void AddParagraph(XWPFParagraph p)
*/
public void RemoveParagraph(int pos)
{
XWPFParagraph removedParagraph = paragraphs[pos];
paragraphs.RemoveAt(pos);
ctTc.RemoveP(pos);
bodyElements.Remove(removedParagraph);
}

/**
Expand Down
54 changes: 54 additions & 0 deletions testcases/ooxml/XWPF/UserModel/TestXWPFTableCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,59 @@ public void TestCellVerticalAlignShouldNotThrowNPE()
}
}
}

[Test]
public void TestAddParagraph()
{
using (XWPFDocument doc = new XWPFDocument())
{
XWPFTable table = doc.CreateTable();
XWPFTableRow tr = table.CreateRow();
XWPFTableCell cell = tr.AddNewTableCell();

// cell have at least one paragraph by default
ClassicAssert.AreEqual(1, cell.Paragraphs.Count);
ClassicAssert.AreEqual(1, cell.BodyElements.Count);
ClassicAssert.AreEqual(cell.GetParagraphArray(0), cell.BodyElements[0]);

XWPFParagraph p = cell.AddParagraph();
ClassicAssert.AreEqual(2, cell.Paragraphs.Count);
ClassicAssert.AreEqual(2, cell.BodyElements.Count);
ClassicAssert.AreEqual(p, cell.GetParagraphArray(1));
ClassicAssert.AreEqual(cell.GetParagraphArray(1), cell.BodyElements[1]);
}
}

[Test]
public void TestRemoveParagraph()
{
using (XWPFDocument doc = new XWPFDocument())
{
XWPFTable table = doc.CreateTable();
XWPFTableRow tr = table.CreateRow();
XWPFTableCell cell = tr.AddNewTableCell();

// cell have at least one paragraph by default
XWPFParagraph p0 = cell.GetParagraphArray(0);
XWPFParagraph p1 = cell.AddParagraph();
cell.AddParagraph();

// remove 3rd
cell.RemoveParagraph(2);
ClassicAssert.AreEqual(2, cell.Paragraphs.Count);
ClassicAssert.AreEqual(2, cell.BodyElements.Count);
ClassicAssert.AreEqual(p0, cell.GetParagraphArray(0));
ClassicAssert.AreEqual(p1, cell.GetParagraphArray(1));
ClassicAssert.AreEqual(p0, cell.BodyElements[0]);
ClassicAssert.AreEqual(p1, cell.BodyElements[1]);

// remove 2nd
cell.RemoveParagraph(1);
ClassicAssert.AreEqual(1, cell.Paragraphs.Count);
ClassicAssert.AreEqual(1, cell.BodyElements.Count);
ClassicAssert.AreEqual(p0, cell.GetParagraphArray(0));
ClassicAssert.AreEqual(p0, cell.BodyElements[0]);
}
}
}
}
Loading