When saving HTML content to a file using Docx, it duplicates the first line if a break is inserted on the second line. Below is a code snippet example. The content in the pre tag will show in the file twice.
Imports Xceed.Document.NET
Imports Xceed.Words.NET
Dim sbHtmlContent As New StringBuilder
sbHtmlContent.Append("<pre>schema-version = 1.0.0</pre>")
sbHtmlContent.Append("<br/>")
sbHtmlContent.Append("<p>some other content<p/>")
Dim htmlContent = sbHtmlContent.ToString
Dim fullFileName As String = "pathtofile.doc"
Dim doc As Xceed.Words.NET.DocX = Xceed.Words.NET.DocX.Create(fullFileName)
doc.InsertContent(htmlContent, Xceed.Document.NET.ContentType.Html)
doc.Save()
UPDATE: This is happening because of the self closing tag. If I replace this
sbHtmlContent.Append("<br/>")
with this
sbHtmlContent.Append("<br></br>")
It doesn't duplicate the first line.