We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML inserted with Document Builder rendering strangely in a docx

There seems to be a problem with how some html renders after it is inserted into a docx document. This code for example:

        <div>asdasdasd asdasdasd</div>
        <div>asdasdasdasd asdasdasd</div>

Each div shows up with what looks like a single line feed when it renders in a browser. When I cut and past the text from the browser into a docx document in word it looks exactly the same. But, when I insert everything inside the body into a docx using the Document Builder. Each line that is rendered for each div is really tall! It looks like it inserted an extra line after each line but it didn’t the line is just really tall with the text forced to the top of the line… Is this normal? Is there some attribute or style I can insert into these tags that will tell aspose not to do this? Or can I enclose all of this in a tag that will fix this?

Bryan Grossman

Thanks for your inquiry. Unfortunately, inline CSS styles support is limited. You can try to do something like this.

foreach (Paragraph par in builder.CurrentSection.Body.Paragraphs)
    par.ParagraphFormat.SpaceAfterAuto = false;
    par.ParagraphFormat.SpaceAfter = 0;

I hope that this will help you.
Best regards.

Thank You! That worked!
Bryan Grossman