I use Words’s DocumentBuilder InsertHtml with htmlTable string.
Then Save to PDF file, the table will exceed page
My code is below,
var doc = new Document();
doc.Styles.DefaultParagraphFormat.Style.Font.NameFarEast = "標楷體";
doc.Styles.DefaultParagraphFormat.Style.Font.NameAscii = "Times New Roman";
doc.Styles.DefaultParagraphFormat.Style.Font.Size = 16D;
var builder = new DocumentBuilder(doc);
var htmlTable = @"<style>
.table {
width: auto;
table-layout:fixed;
}
.table, .table tr {
height: 40px;
}
.table, .table td {
border-collapse: collapse;
border: 1px solid #000000;
padding:2px 5px 2px 5px;
}
</style>
<table class='table' style='width: 100%;'>
<colgroup>
<col style='width: 15%;'>
<col style='width: 35%;'>
<col style='width: 15%;'>
<col style='width: 35%;'>
</colgroup>
<tbody>
<tr>
<td>TITLE1:</td>
<td></td>
<td>TITLE2:</td>
<td>106/10/14 22:26</td>
</tr>
<tr>
<td>TITLE3:</td>
<td colspan='3'>測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試測試</td>
</tr>
</tbody>
</table>";
builder.InsertHtml(htmlTable, true);
doc.Save("TEST.pdf", SaveFormat.Pdf);
Thanks for your help