This project has moved and is read-only. For the latest updates, please go here.

Paragraphs inserted before/after table has no main part

Jan 30, 2016 at 10:24 AM
Edited Jan 30, 2016 at 10:25 AM
If you insert a paragraph by table.InsertParagraphBeforeSelf(), new paragraph's main part will be null, this will cause NRE if you will try insert picture into this paragraph

for example:
            DocX document = DocX.Create(resultFileName);

            Table table = document.AddTable(1, 1);

            Table newTable = document.InsertTable(table);
            Paragraph paragraph = newTable.InsertParagraphBeforeSelf("");
            //paragraph.PackagePart == null
            Image image = document.AddImage("SomeImageFile.jpg");
            Picture picture = image.CreatePicture();

            paragraph.InsertPicture(picture); //have NullReferenceException here
Feb 4, 2016 at 8:13 AM
Feel free to submit a fix :) I am gathering things up to build new release.