Hi Sirs,
DocumentBuilder InsertHtml (nested table) Save as pdf , some TD will disapper
My code is below,
var htmlTable2 = @"<style>
div[data-speed-id=seal-box] {
margin-top: 20px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
height: 20px;
}
td[data-speed-sealouid] {
width: 60px;
}
table[data-speed-id='seal-table'] {
border: 1px solid red !important;
color: red !important;
border-collapse: initial;
}
table[data-speed-id=seal-table] td {
padding: 0px !important;
margin: 0px !important;
border: 0px;
border-collapse: collapse;
border-spacing: 0px !important;
vertical-align: middle !important;
}
</style>
<div style='color: blue;'>下面是原本職章結構直接輸出,</div>
<table>
<colgroup>
<col style='width:35%;'>
<col style='width:65%;'>
</colgroup>
<tbody>
<tr>
<td>
<div style='margin-top: 10px;' data-speed-id='seal-box'>
<table>
<tbody>
<tr>
<td>
<table data-speed-id='seal-table'>
<tbody>
<tr>
<td style='font-size: 10px;' data-speed-sealouid='10110'>文化資源司</td>
<td style='font-size: 16px;' rowspan='2'>亂馬客</td>
</tr>
<tr>
<td style='font-size: 10px;'>科員</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style='text-align: center; font-size: 12px;'>106/10/18 10:36</td>
</tr>
</tbody>
</table>
</div>
</td>
<td>
案係亂馬客測試文化局將於本(105)年10月29日召開「106亂馬客測試社區營造平台工作小組第九十次會議」,本部為列席單位,擬視業務狀況再行派員,當否?請核示。文陳閱後存查。
</td>
</tr>
</tbody>
</table>";
builder.InsertHtml(htmlTable2, true);
//doc.CompatibilityOptions.GrowAutofit = false;
doc.UpdateTableLayout();
doc.Save("test.doc", SaveFormat.Doc);
doc.Save("TEST.pdf", SaveFormat.Pdf);
disapper.png (117.2 KB)
Thanks for your help