Ok so basically i want to display a word doc in the browser as readyonly no editing required access from file and display.... im not particular about it being a word doc but i want the display to inherit text formatting and maybe even include pics if possible. I have currently used the following set of code
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Link"] != null)
{
String link = Session["Link"].ToString();
ApplicationClass appClass = new ApplicationClass();
object missing = System.Reflection.Missing.Value;
object visible = true;
object readOnly = true;
object fileName = link;
Document wordDoc = appClass.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref visible, ref missing, ref missing, ref missing, ref missing, ref missing);
TextArea1.InnerText = wordDoc.Content.Text;
appClass.Application.Quit(ref missing, ref missing, ref missing);
}
else
{
DataSet ds = new DataSet();
ds = WCGSQL.showdata("select max(Date) from WeeklyMsg");
if (ds != null)
{
String MaxDate = ds.Tables[0].Rows[0][0].ToString();
ds = WCGSQL.showdata("select * from WeeklyMsg where Date='" + MaxDate + "'");
String link = ds.Tables[0].Rows[0][0].ToString();
String Path = "i:\\Website/WebSite3/WMSG/" + link;
ApplicationClass appClass = new ApplicationClass();
object missing = System.Reflection.Missing.Value;
object visible = true;
object readOnly = true;
object fileName = Path;
Document wordDoc = appClass.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref visible, ref missing, ref missing, ref missing, ref missing, ref missing);
TextArea1.InnerText = wordDoc.Content.Text;
appClass.Application.Quit(ref missing, ref missing, ref missing);
}
}
}
Which worked file for an asp website but when i use it on a asp web app it give me the following error
Error 2 Task could not find "AxImp.exe" using the SdkToolsPath "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed WebApplication2
really open to any ideas that can fix this even external apps (it would be best if it is free creating site for non profit org so got a really limited budget)
thx in advance Mark