Hi,
_listLevel = 0;
_listTemplate = new Collection<Paragraph>();using (FileStream templateStream = new FileStream(listTemplate, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite))
{
_partToInsert = new Document(templateStream);<span style="color:#4ec9b0;">Section</span> section <span style="color:#b4b4b4;">=</span> (<span style="color:#4ec9b0;">Section</span>)_partToInsert<span style="color:#b4b4b4;">.</span>ChildNodes[<span style="color:#b5cea8;">0</span>]; <span style="color:#4ec9b0;">Body</span> body <span style="color:#b4b4b4;">=</span> (<span style="color:#4ec9b0;">Body</span>)section<span style="color:#b4b4b4;">.</span>ChildNodes[<span style="color:#b5cea8;">0</span>]; <span style="color:#569cd6;">foreach</span> (<span style="color:#4ec9b0;">Paragraph</span> para <span style="color:#569cd6;">in</span> body<span style="color:#b4b4b4;">.</span>ChildNodes) { _listTemplate<span style="color:#b4b4b4;">.</span>Add(para); } _partToInsert<span style="color:#b4b4b4;">.</span>RemoveAllChildren();
}
_inserter = new DocumentBuilder(_partToInsert);
_inserter.InsertNode(_listTemplate[_listLevel]);
Idea is to load the complete Template into the _partToInsert Document, then extract the
single lines of it. After i got every line, i clear _partToInsert and use
DocumentBuilder.InsertNode() to add the line i need at this point. I repeat this step
for every line i want to add independend of list level.
But when calling InsertNode() method i get the System.ArgumentException telling me that
i cannot insert this node at this location.
Why is this the case and how can i fix it?
Greetings,
Crazkur
PS: i attached the ListTemplate i use