Images are not processing in word to html conversion

Jan 30 2014 4:43 AM
Hi,
 
i am using "Microsoft.Office.Interop.Word" to convert .doc files to html. but these are not processing images . please help me.. this is my code
 
 
filename = Server.MapPath("ServicesDoc.docx");

Microsoft.Office.Interop.Word.ApplicationClass AC = new Microsoft.Office.Interop.Word.ApplicationClass();

//Microsoft.Office.Interop.Word.Document doc = new Microsoft.Office.Interop.Word.Document();

object readOnly = false;

object isVisible = true;

object missing = System.Reflection.Missing.Value;

object documentFormat = 10;

string randomName = DateTime.Now.Ticks.ToString();

object htmlFilePath = Server.MapPath("~/Temp/") + randomName + ".html";
try
{
//Open the word document in background
ApplicationClass applicationclass = new ApplicationClass();
applicationclass.Documents.Open(ref filename);

applicationclass.Visible = false;
Document doc = applicationclass.ActiveDocument;

//doc = AC.Documents.Open(ref filename);
//Save the word document as HTML file
doc.SaveAs2(ref htmlFilePath, ref documentFormat);

doc.Close(ref missing, ref missing, ref missing);
byte[] bytes;
using (FileStream fs = new FileStream(htmlFilePath.ToString(), FileMode.Open, FileAccess.Read))
{
BinaryReader reader = new BinaryReader(fs);
bytes = reader.ReadBytes((int)fs.Length);
fs.Close();
}
Response.BinaryWrite(bytes);
Response.Flush(); 

Answers (2)