Hello,
Hi Christian,
- Your input Word document you’re getting this problem with.
- The Aspose.Words generated output document which shows the undesired behavior.
- The HTML snippet you’re inserting in document using InsertHtml method.
- Please create a standalone (runnable) simple console application that helps us reproduce your problem on our end and attach it here for testing.
Thank you for the reply. I’ve attached a simple console application which inserts a bullet list in a docx-file, as well as the template (HtmlTmeplate.docx) and a document modified by the console application (ModifiedDocument.aspx).
<o:p></o:p>
Hi Christian,
bookmark, string value, Document document)
{
var builder = new DocumentBuilder(document);
var docBookmark = document.Range.Bookmarks[bookmark];
docBookmark.Text = "";
if (builder.MoveToBookmark(bookmark, true, true))
{
builder.InsertHtml(value);
BookmarkEnd bmEnd = docBookmark.BookmarkEnd;
Node parentNode = bmEnd.ParentNode;
if (bmEnd.ParentNode.ChildNodes.Count == 1)
{
((Paragraph)parentNode.PreviousSibling).AppendChild(bmEnd);
parentNode.Remove();
}
}
return document;
}