C # Instrument data file parsing-word file (Doc, docx)

Source: Internet
Author: User
Tags format definition

A lot of instrument data report output for Word format file, the same as Excel file, Word file doc and docx storage format is different, corresponding parsing Word file way also similar, mainly in the following ways:

1. DCOM interface via MS Word application;

2.WPS the DCOM interface of the Word application, other Office applications, such as open office, etc.;

3.NPOI Library;

4.MS Open XML;

5.spire.doc Library;

In practice, different manufacturers such as MS and Open office have differences in the format definition standards for word (or a generic word-processing software document in office), so there is a compatibility issue;

Even though MS's docx format files, 2007, 2010, 2013 and other versions are defined using XML format, they are still different and have compatibility issues.

Therefore, if you use other applications such as open Office to work with Word documents, most customers end up using MS Office, there are many issues.

An application that can handle MS Word documents well, the easy-to-use application is Ms Office Word, WPS, and the usable component library is Spire.doc,npoi (docx only).

The advantage of using component libraries is that you do not need to install applications, are simple to deploy, and also better than DCOM interfaces through. Net framework calls.

Because Spire.doc is a toll component, we recommend that you use Npoi to resolve word, which is, of course, limited to Word 2007+.

The following are the key codes for reference:

FileStream FileStream = new FileStream (FileName, FileMode.Open, FileAccess.Read); xwpfdocument = new Xwpfdocument (( Stream) fileStream); foreach (Xwpfparagraph xwpfparagraph in (ienumerable<xwpfparagraph>) xwpfdocument.paragraphs)                stringbuilder.appendline (Xwpfparagraph.paragraphtext);

  

C # Instrument data file parsing-word file (Doc, docx)

Related Article

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.