hi to evry one.
Firs i am sorry for my bad english language.
i work on winform application that load word file in web browser control with convert word to html that work fine
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Microsoft.Office.Interop.Word;
using System.IO;
namespace myapp
{
delegate void ConvertDocumentDelegate(string fileName);
public partial class DrugInfoForm : Telerik.WinControls.UI.RadForm
{
object oDocument;
public MyAppForm(string _docname)
{
InitializeComponent();
doc_name = _docname;
}
string doc_name;
string tempFileName = null;
private void MyAppForm_Load(object sender, EventArgs e)
{
string filen= "word path";
LoadDocument(filen);
}
public void LoadDocument(string fileName)
{
ConvertDocumentDelegate del = new ConvertDocumentDelegate(ConvertDocument);
del.BeginInvoke(fileName, DocumentConversionComplete, null);
}
void ConvertDocument(string fileName)
{
object m = System.Reflection.Missing.Value;
object oldFileName = (object)fileName;
object readOnly = (object)false;
Microsoft.Office.Interop.Word.ApplicationClass ac = null;
try
{
ac = new Microsoft.Office.Interop.Word.ApplicationClass();
Document doc = ac.Documents.Open(ref oldFileName, ref m, ref readOnly,
ref m, ref m, ref m, ref m, ref m, ref m, ref m,
ref m, ref m, ref m, ref m, ref m, ref m);
tempFileName = GetTempFile("html");
object newFileName = (object)tempFileName;
object fileType = (object)WdSaveFormat.wdFormatHTML;
doc.SaveAs(ref newFileName, ref fileType,
ref m, ref m, ref m, ref m, ref m, ref m, ref m,
ref m, ref m, ref m, ref m, ref m, ref m, ref m);
}
finally
{
if (ac != null)
ac.Quit(ref readOnly, ref m, ref m);
}
}
void DocumentConversionComplete(IAsyncResult result)
{
webBrowser1.Navigate(tempFileName);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (tempFileName != string.Empty)
{
System.IO.File.Delete(tempFileName);
tempFileName = string.Empty;
}
}
string GetTempFile(string extension)
{
return Path.Combine(Path.GetTempPath(),
Path.ChangeExtension(Path.GetRandomFileName(), extension));
}
}
}
BUT
i have problem with link in word file , i want to word file that linked open like before
but when click in links open microsoft word in web browser i dont want this
please help me