Method .InsertParagraphAfterSelf(paragraph) does not move FollowingTables to a new paragraph

Open
#481 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
tooling

Research direction

Start by locating the InsertParagraphAfterSelf method and the FollowingTables and InsertTableAfterSelf behavior. Reproduce the reported paragraph-and-table scenario from the issue, then verify that inserting a paragraph preserves the following tables so copying the original paragraph includes them.

Written by the indexing model from the issue text.

Description

Hi, I have found a problem that when I add a paragraph using the .InsertParagraphAfterSelf(paragraph) method, FollowingTables are not wrapped into the new paragraph.
Example:
image
If I start copying the first paragraph 1. One, it will be copied without the table. Which is why I have to write something like this:

      public static Paragraph InsertParagraphAfterSelfWithTables(this Paragraph self, Paragraph paragraph)
        {
            var newParagraph = self.InsertParagraphAfterSelf(paragraph);

            if ((paragraph.FollowingTables?.Count ?? 0) > 0 && 
                (newParagraph.FollowingTables?.Count ?? 0) == 0)
            {
                foreach (var table in paragraph.FollowingTables!)
                {
                    newParagraph.InsertTableAfterSelf(table);
                }
            }

            return newParagraph;
        }
Dominant language
C#
Stars
1.9k
Forks
483
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xceedsoftware/DocX

All issues in xceedsoftware/DocX

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.