Hi to all,
I have the following code which opens a word document and then save it as RTF format.
The problem is the following the code is working perfect from a development machine but it has an error on another development machine this:
"An unhandled exception of type System.IO.FileNotFoundException in windowsapplication1.exe additional information: The specified module could not be found.
The above error happens during the declaration of OoWordApp ApplicationClass.
Both machines have the same office 2003 and the same Windows XP SP2.
Please i need your help
Many thanks!
public void ImportFromWordToTern(string filepath,string RTFPath)
{
object fileName = @filepath;
object fileName2 = @RTFPath+@"\"+ this.tmstamp() + @"_eproduction.rtf";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
object savechanges=false;
object originalformat=System.Reflection.Missing.Value;
object format=(object)Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF;
string temp="";
string rtfdata="";
Microsoft.Office.Interop.Word.ApplicationClass oWordApp =new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing,ref missing,ref missing, ref missing);
oWordDoc.SaveAs(ref fileName2,ref format,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing);
oWordApp.Quit(ref savechanges,ref originalformat,ref originalformat);
I have the following code which opens a word document and then save it as RTF format.
The problem is the following the code is working perfect from a development machine but it has an error on another development machine this:
"An unhandled exception of type System.IO.FileNotFoundException in windowsapplication1.exe additional information: The specified module could not be found.
The above error happens during the declaration of OoWordApp ApplicationClass.
Both machines have the same office 2003 and the same Windows XP SP2.
Please i need your help
Many thanks!
public void ImportFromWordToTern(string filepath,string RTFPath)
{
object fileName = @filepath;
object fileName2 = @RTFPath+@"\"+ this.tmstamp() + @"_eproduction.rtf";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
object savechanges=false;
object originalformat=System.Reflection.Missing.Value;
object format=(object)Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF;
string temp="";
string rtfdata="";
Microsoft.Office.Interop.Word.ApplicationClass oWordApp =new Microsoft.Office.Interop.Word.ApplicationClass();
Microsoft.Office.Interop.Word.Document oWordDoc = oWordApp.Documents.Open(ref fileName, ref missing,ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing,ref missing,ref missing, ref missing);
oWordDoc.SaveAs(ref fileName2,ref format,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing);
oWordApp.Quit(ref savechanges,ref originalformat,ref originalformat);