DocX icon indicating copy to clipboard operation
DocX copied to clipboard

Inserting new table rows does not update paragraphs if document is loaded

Open Skyswimsky opened this issue 3 years ago • 1 comments

Hi!

Following error: If you load a Document and insert rows in a table, the paragraph count isn't updating. Instead you have to load the document anew.

I've provided an example code that demonstrates the issue below.

using (DocX document = DocX.Create(copyPath))
{
	document.InsertTable(3, 3);
	Console.WriteLine("Paragraphs after table creation and doc creation: " + document.Paragraphs.Count);
	document.Save();
}
		
using (DocX document = DocX.Load(copyPath))
{
	foreach (var table in document.Tables)
	{
		Row row = table.Rows[0];
		table.InsertRow(row);
	}
	document.Save();

	Console.WriteLine("Paragraphs after row insertion and doc loading: " + document.Paragraphs.Count);
}
		
using (DocX document = DocX.Load(copyPath))
{
	Console.WriteLine("Paragraphs after doc loading no row insertion: " + document.Paragraphs.Count);
}

I've attached a screenshot for a visual aid of what I meant: docXBugTableLoadParagraph

Skyswimsky avatar Jul 12 '22 12:07 Skyswimsky

Hi, Thank you for bringing this to our attention. It will be fixed in v2.4. Have a nice day.

XceedBoucherS avatar Aug 10 '22 20:08 XceedBoucherS