原創|其它|編輯:郝浩|2012-10-19 17:18:44.000|閱讀 1877 次
概述:Aspose.Words使用DocumentBuilder.InsertHtml方法,就可以支持插入為一個HTML源中的文檔插入內容。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Words使用DocumentBuilder.InsertHtml方法,就可以支持插入為一個HTML源中的文檔插入內容。 輸入可以是一個完整的HTML頁面或只是一個部分片段。使用這種方法我們可以利用表元素如< table >、< tr >、< td >為我們的文檔插入表。
C#
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Insert the table from HTML. Note that AutoFitSettings does not apply to tables // inserted from HTML. builder.InsertHtml("<table>" + "<tr>" + "<td>Row 1, Cell 1</td>" + "<td>Row 1, Cell 2</td>" + "</tr>" + "<tr>" + "<td>Row 2, Cell 2</td>" + "<td>Row 2, Cell 2</td>" + "</tr>" + "</table>"); doc.Save(MyDir + "DocumentBuilder.InsertTableFromHtml Out.doc");
Visual Basic
Dim doc As New Document() Dim builder As New DocumentBuilder(doc) ' Insert the table from HTML. Note that AutoFitSettings does not apply to tables ' inserted from HTML. builder.InsertHtml("<table>" & "<tr>" & "<td>Row 1, Cell 1</td>" & "<td>Row 1, Cell 2</td>" & "</tr>" & "<tr>" & "<td>Row 2, Cell 2</td>" & "<td>Row 2, Cell 2</td>" & "</tr>" & "</table>") doc.Save(MyDir & "DocumentBuilder.InsertTableFromHtml Out.doc")
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網