Hello Binh!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thank you for asking this.
I tried to insert the given HTML fragment to an empty document and obtained some unexpected spaces as well. The code I was using is the following:
public static void TestRandomSpaces()
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
StreamReader reader = File.OpenText("random_spaces.txt");
string content = reader.ReadToEnd();
builder.InsertHtml(content);
builder.InsertHtml("
");
doc.Save("random_spaces_result.doc");
}
The issue has been logged as #4424 in our defect database. We’ll investigate it and provide more information when it is fixed or some update is available.
As a workaround you can try adding the contents by separate paragraphs.
Regards,