Conversion from word to html

Source: Internet
Author: User

I read an article about converting word to html on the Internet. It feels good to share with you.

ConvertWordToHtml (word. applicationClass word = Type wordtype = word. documents docs = Type docstype = word. document doc = (word. document) docstype. invokeMember (, System. reflection. bindingFlags. invokeMethod, docs, [] {wordfilename, Type doctype = wordsavefilename = strsavefilename = wordsavefilename. substring (, wordsavefilename. length-) + savefilename = (doctype. invokeMember (, System. reflection. bindingFlags. invokeMethod, doc, doctype. invokeMember (, System. reflection. bindingFlags. invokeMethod, doc, wordtype. invokeMember (, System. reflection. bindingFlags. invokeMethod, word ,}Conversion from word to html

Make some preparations before this

1. You must have an office component.

2. Add reference as follows:

Word = Microsoft. Office. Interop. Word;Page reference namespace

3. Add Microsoft. Office. Interop. Word reference to the project.

4. If the code word. applicationClass word = new word. applicationClass (); prompt that the interoperability type cannot be embedded, right-click Microsoft. office. interop. select the attribute of the Word component and change the embedded interoperability type to False to solve the problem.

After that, an html file with the same name will appear in the folder where the word file is located. However, one disadvantage is that the word layout format cannot be saved. Improvement later.

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.