Hi,
I’m performing a mailmerge, and one of the fields contain a html table. The code inserts and renders the table, however, I can’t seem to control the height of the rows. No matter what value I try, there is always a blank line after the td content.
Here is a merge value:
<table cellpadding=0 cellspacing=0 border=1 width='100%'>
<tr height='10px' style='height:10px;' >
<td height='10px' style='height:10px;' colspan=3>Coverage Period 08/20/2024 - 06/19/2025
</td>
</tr>
<tr height='10px' style='height:10px;' >
<td height='10px' style='height:10px;' > John Doe
</td>
<td height='10px' style='height:10px;' >Ruby Plan</td>
<td height='10px' style='height:10px;' align='right'>$1,501.30</td>
</tr>
</table>
(I tried setting everything to a height of 10px).
And attached is an image of the rendered table. I cannot seem to get rid of the whitespace below each value.
Any ideas?
Thanks!
I don’t know why, but the complete sample of html didn’t post in my previous comment. Let me try again
<table cellpadding=0 cellspacing=0 border=1 width='100%'>
<tr height='10px' style='height:10px;' >
<td height='10px' style='height:10px;' colspan=3>Coverage Period 08/20/2024 - 06/19/2025
</td>
</tr>
<tr height='10px' style='height:10px;' >
<td height='10px' style='height:10px;' > John Doe
</td>
<td height='10px' style='height:10px;' >Ruby Plan</td>
<td height='10px' style='height:10px;' align='right'>$1,501.30</td>
</tr>
</table>
Ok, so, I decided to just call .Save(…) on the Document object, but, use SaveFormat.Html to try and discover something.
html_equiv.png (27.1 KB)
It looks like the content is being wrapped in
tags with margin-bottom values.
Any ideas how I can prevent that?
@todusjay Could you please provide code that will allow us to reproduce the problem and the output document produced on your side? I tested with the following simple code and the problem is not reproducible:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(File.ReadAllText(@"C:\Temp\in.html"));
doc.Save(@"C:\Temp\out.docx");
out.docx (7.4 KB)