locked
converting Word to HTML at runtime RRS feed

  • Question

  • Is there a way to automatically convert a Word document to HTML at runtime, such as within an ASP.NET application?
    Friday, September 2, 2011 3:58 PM

Answers

  • Hello PJ7,

       for converting a word document to html at runtime in asp.net , recommand you to use Spire.Doc, it may useful to you.
    use following code to automatically convert a word document to html.

    using System;
    using Spire.Doc;
    using Spire.Doc.Documents;
    namespace WordToHTML
    {
      class Program
      {
        static void Main(string[] args)
        {
          //Create a new document
          Document document = new Document();
          //Load word 97~2010 file from disk.
          document.LoadFromFile("WordFile.docx");
          //Save doc file to pdf.
          document.SaveToFile("Sample.html", FileFormat.HTML);
        }
      }
    }
    • Marked as answer by Liliane Teng Friday, September 9, 2011 8:16 AM
    Monday, September 5, 2011 2:51 AM

All replies

  • Could you please elaborate a bit on what it is you need to do, exactly (the business logic)?

    Which version(s) of Word do you intend to support?

    Is a Sharepoint server available to you?


    Cindy Meister, VSTO/Word MVP
    Saturday, September 3, 2011 8:12 AM
  • Hello PJ7,

       for converting a word document to html at runtime in asp.net , recommand you to use Spire.Doc, it may useful to you.
    use following code to automatically convert a word document to html.

    using System;
    using Spire.Doc;
    using Spire.Doc.Documents;
    namespace WordToHTML
    {
      class Program
      {
        static void Main(string[] args)
        {
          //Create a new document
          Document document = new Document();
          //Load word 97~2010 file from disk.
          document.LoadFromFile("WordFile.docx");
          //Save doc file to pdf.
          document.SaveToFile("Sample.html", FileFormat.HTML);
        }
      }
    }
    • Marked as answer by Liliane Teng Friday, September 9, 2011 8:16 AM
    Monday, September 5, 2011 2:51 AM
  • Hi PJ7,

    You could also check this thread about how to convert Word to HTML. Please have a try and let us know the situation on your side.

    http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/1ce972ab-8a88-4962-a2fd-482c9210718c
    (Convert from Word to HTML)

    If you have any concerns, please feel free to follow up.

    Have a nice day.

    Best regards


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, September 7, 2011 8:03 AM
  • Hi all

      Its converting word to html but alignment is problem in case of images how to fix it please help me

    Wednesday, October 30, 2013 5:01 AM