Use the Docx component to export Word under SharePoint

Source: Internet
Author: User

Normal development, more or less need to deal with Word, the special change is to edit, export word.

With docx, open source, read-write Word components can quickly help us with word operations.

Docx Official website: http://docx.codeplex.com/

Docx main functions

Inserts, deletes, or replaces text in a document (Word), supporting all standard text formats, such as font {Family,size,color}, out, italic, underline, highlighting, and so on.

Provides paragraph properties that you can set to its orientation, such as left-to-right, center alignment, and so on.

Docx also supports the operation of the picture, hyperlinks, tables, pages, headers, and so on.

The most important point docx supports custom document properties (custom properties)

Recently, to make a change to a SharePoint project, the customer wants to export word for easy printing after the document approval for the escalation (as shown below) is completed. For OA system, this is very important function, customer rush, so need rapid development.

Create Document properties

docx support Load a predetermined template, through the modification of the template can create a new Docx type object, directly invoke the Docx.saveas method can be saved to the specified path, of course, you can also save to a memory stream. Specific powerful features can be referenced docx provide example, written in very detail.

Cut the crap, let's get started. Word2010 (07 uncertain, unused) the above version supports document properties (Doc propery), document properties are a very important feature for developers, you can extend the properties of Word documents, and I use Word 2013 as an example to open Word 2013, click on the top left corner of the file, in the new pop-up page, select the Properties à advanced properties, as follows:

Next, create a new document property, pay attention to an appropriate name, and do not duplicate the existing attributes, for the above image of the complaint approval, you can create the following document properties:

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.