Hi.
I'm currenty trying some new things with OpenXml but I recently came across some trouble. As the title says I'm trying to insert data dynamically into a table using Xml. To indentify the table in my Worddoc I've put a Rich Text Content Control arround it.
Everything worked & looked fine until I tried to search my document for the tagname of the Rich Text Content Control. I keep getting a "Object reference not set to an instance of an object." while running my code.
He's the line where it happens:
SdtBlock ccWithTable = mainPart.Document.Body.Descendants<SdtBlock>().Where(r => r.SdtProperties.GetFirstChild<Tag>().Val == t.Name).Single();
I've used following MSDN document to try and achieve my goal, without succes:
Inserting Repeating Data Items into a Word 2007 Table by Using the Open Xml API
If anyone can help me, I would love you long time.