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

Free Support Forum - aspose.com

Bottom margin ignored for div that contains a table

Hi.

I'm currently evaluating Aspose.Words to use on a project. Specifically, I am interested in the HTML-to-DOCX conversion functionality.

It works pretty well for our HTML, but there is one case I found where it doesn't render in the DOCX correctly. That case is when I have a table nested within a div that has a bottom margin. The problem is that the bottom margin doesn't get applied in the DOCX output.

If my HTML looks like this...

AAA
BBB

... Then in a browser, there is 20px between the AAA and BBB lines.

However, when I use Aspose Words to convert this HTML to DOCX, there is no space at all between AAA and BBB.

So my questions are:

1. How can I report this to Aspose as a possible bug to be fixed?

2. Does anyone know a workaround for this? I have tried some different things using CSS, but I haven't be able to make it come out right. I know I could put in a
or
 
or something like that to force space in the output, but I'm hoping for a CSS workaround if possible so I don't have to alter the HTML itself.

Thanks in advance for any help you can provide,

-Brian


P.S. For reference, here is a console app to reproduce the problem.
namespace AsposeTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string html = @"
                
                
	                
AAA
BBB
";
        <span style="color:blue;">using</span> (<span style="color:blue;">var</span> ms = <span style="color:blue;">new</span> System.IO.<span style="color:#2b91af;">MemoryStream</span>(System.Text.<span style="color:#2b91af;">Encoding</span>.UTF8.GetBytes(html)))
        {
            <span style="color:blue;">var</span> doc = <span style="color:blue;">new</span> Aspose.Words.<span style="color:#2b91af;">Document</span>(ms, 
                <span style="color:blue;">new</span> Aspose.Words.<span style="color:#2b91af;">LoadOptions</span>() { LoadFormat = Aspose.Words.<span style="color:#2b91af;">LoadFormat</span>.Html });
            doc.Save(<span style="color:#a31515;">@"aspose.docx"</span>, Aspose.Words.<span style="color:#2b91af;">SaveFormat</span>.Docx);
        }
    }
}

}

Hi Brian,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10279. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

Unfortunately, there is no workaround available for this issue. We apologize for your inconvenience.

Hi Brian,

Thanks for your patience.

It
is to update you that our development team has completed the
analysis of this issue and has come to a conclusion that this issue has
been closed with ‘‘Won’t Fix’’ resolution. I am quoting the developer’s comments here:

Normal (non-floating) tables in MS Word do not have vertical margins (space before and after), so in the following example the ‘margin-bottom’ style imported from the

element cannot be applied to the table:




AAA


BBB


As a workaround of this issue, please do not use table’s ‘margin-bottom’. Please use the ‘margin-top’ value of the paragraph right after the table, as shown in the following code (vertical margins of paragraphs are correctly imported from HTML as paragraph spacings):




AAA


BBB