Using Aspose.Words 5.0, we are experiencing random leading spaces when using InsertHTML. I’ve attached the snippet of HTML that was inserted and the following reply will contain the resulting document.
The code that performs the insert is just 2 lines:
Attached is the resulting document. The inerted sample starts on page 9 and is labeled with the text
“Test Analysis: Behavior Assessment System for Children, Parent Rating Scales-Child”
Please let me know what you find…
Regards,
Binh
Hello Binh!
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("<br>");
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,
Hello!
This issue is still open and I cannot give estimate. Have you tried adding text line by line? We can think about any other workarounds together.
Thank you for understanding,
I am welcome to any workarounds. However, I’m not sure what you mean by line by line. We have a WYSIWYG html editor that emits HTML fragments. These fragments are stored in the DB and read out into a InsertHTML call.
Could this issue be fixed by pre-processing the HTML somehow?
Hello!
I meant that if your fragment consists of several sentences delimited by
you can try splitting it on them. Of course if fragments can be of any structure this is not a case.
I’ll come back to this issue but not immediately now.
Regards,
Hello!
That’s even sooner. We planned to release on Monday but for technical reasons postponed this to one more day. I hope we release on Tuesday. Note possible difference in time zones.
Regards,