5
Answers

convert word document to html and vice versa including images

Hi , Could any one please tell me the procedure to convert word document to html page

i am able to convert the html page to word document using stream reader but images in it or missing. could u please tell me the procedure or any API to achieve the above specified task.

i want solution other than using Microsoft.Interop.Word as my architecture said it is not reliable dll for server side coding in Asp.net


Thanks in advance...
Answers (5)
1
Derek Stevens

Derek Stevens

NA 35 8 4y
If you are looking for a different API, you could try the Leadtools SDK. You can convert from Word to Html really easily with only a few lines of code. This example is pulled from their documentation page for DocumentConverter:
 
https://www.leadtools.com/help/sdk/v21/dh/doxc/documentconverter.html
  1. using (var documentConverter = new DocumentConverter()){  
  2.     string inFile = @"C:\temp\input.docx";  
  3.     string outFile = @"C:\temp\output.html";  
  4.     var jobData = DocumentConverterJobs.CreateJobData(inFile, outFile, DocumentFormat.Html);   
  5.    
  6.     var documentWriter = new DocumentWriter();   
  7.     documentConverter.SetDocumentWriterInstance(documentWriter);  
  8.    
  9.     var job = documentConverter.Jobs.CreateJob(jobData);   
  10.     documentConverter.Jobs.RunJob(job);  
  11. }  
1
Alex Smith

Alex Smith

NA 376 16.8k 10y
[quote] i am developing this time application in a system it doesn't conatain Ms office so Microsoft.Office.Interop.Word.dll will not support.[/quote]

hi, Pramod Since you do not need MS Office to be installed on developer machine, I recommend C# Word component which enables programmers to manipulate Word files in .NET platform without MS automation. More specific
please check - Convert Word from/to HTML with Embedded Image.

Hope it works for your situation.


1
Edda Brown

Edda Brown

NA 18 0 10y
Hi, here is a straightforward API for converting between HTML files and Word files in .net:

// Convert Word to HTML.
DocumentModel.Load("Sample.docx").Save("Sample.html");

// Convert HTML to Word.
DocumentModel.Load("Sample.html").Save("Sample.docx");

It is from this Word processing library (for .NET).
1
Hi Sutish Nair thank u very much for u r reply.. it had helped me a lot in converting word to html and html to word.

I want same for open document to html and html to open document conversion, i am developing this time application in a system it doesn't conatain Ms office so Microsoft.Office.Interop.Word.dll will not support.

So with out ms office word document , i want to convert the open source document to html and reverse


Could you please help me on this thanking you...