Insert a table from HTML with aspose. Words

Source: Internet
Author: User

Source: huide Control Network

Using the documentbuilder. inserthtml method, aspose. Words can be inserted into a document in an HTML source. The input can be a complete HTML page or a part of the clip. In this way, we can use table elements such as <Table>, <tr>, and <TD> to insert tables for our documents.

C #

1234567891011121314151617 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

12345678 Dim
doc
As NewDocument()
Dim
builder
As NewDocumentBuilder(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")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.