Manipulating Word documents on server without Office installed (ASP.NET)

前端 未结 4 879
名媛妹妹
名媛妹妹 2020-12-15 05:37

I\'m working on a code to make a MS Word to HTML system. After googleing for about half a minute, I was able to find the code which does exactly what I need. Now.. It works

4条回答
  •  长情又很酷
    2020-12-15 06:26

    you can use Code7248.word_reader.dll

    below is the sample code on how to use Code7248.word_reader.dll

    add reference to this DLL in your project and copy below code.

    using System;
    using System.Collections.Generic;
    using System.Text;
    //add extra namespaces
    using Code7248.word_reader;
    
    
    namespace testWordRead
    {
        class Program
        {
            private void readFileContent(string path)
            {
                TextExtractor extractor = new TextExtractor(path);
                string text = extractor.ExtractText();
                Console.WriteLine(text);
            }
            static void Main(string[] args)
            {
                Program cs = new Program();
                string path = "D:\Test\testdoc1.docx";
                cs.readFileContent(path);
                Console.ReadLine();
            }
        }
    }
    

提交回复
热议问题