With Aspose.words for. NET dynamically generate a table of data in a Word document

Source: Internet
Author: User

1. Overview

The recent project has one such requirement: Export Word documents, require that the format of the document is not fixed, users can easily adjust the data table columns in the export content is dynamic, for example, to export the name and gender, you need to export the two columns of data, And this document is not exported after the adjustment but after the guidance has been adjusted. See here, you may immediately think of using template export! And. NET with this component: Microsoft.Office.Interop.Word, you can meet the demand. However, this component is also limited, such as the client must install Office components, and high coding complexity. The most troublesome requirement is the----Dynamic table column header in the back! The following is a description of how to use the aspose.words for. NET to dynamically generate a table of data in a Word document.

2, the text

Aspose.words, is one of the Aspose "Family Class library". In addition to this, there are many other powerful class libraries such as Aspose.pdf (Operation PDF file class library), Aspose.flash (operation of the Flash File class library), Aspose.report (operation of the report of the class library) and so on, you can be interested in the official web research. These class libraries all contain two languages, one is Java, the other is. NET. This is mainly about aspose.words for. Net. Aspose.words for. NET is very powerful, you don't need to install Office components, you can use this to build Word documents. Aspose.words supports DOC,DOCX,OOXML,RTF format, HTML format, OpenDocument format, PDF format, and other formats. From the figure below, you can learn more about the Aspose.words architecture. A little forgot to mention, this set of class library is charged, in this article I will provide a crack version of the download address to everyone.

Before describing how to dynamically generate a table, let's look at how this class library generates values based on the template:

First, let's build a Word template: Template.doc. Create a bookmark in the document where you want the data to be generated, as shown in figure:

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.