Problem of openning doc files on IIS 7

E

Eslam Kamal

Hi,
I have a Web Application with this C# code hosted in IIS 7 (Vista).
I have Word 2007 on the server. My target is to save files as RTF.
--------------------------------------------------------------------------------
// Save As RTF
//
object True=true, False=false, Missing = System.Reflection.Missing.Value;
ApplicationClass app = new ApplicationClass();
object inFormat = WdOpenFormat.wdOpenFormatAuto;
//
// The following line fails to open the file and "doc" is always null
//
Document doc = app.Documents.OpenOld(ref inFile,ref False,
ref True,ref False,ref Missing,ref Missing,ref Missing,
ref Missing,ref Missing,ref inFormat);
//
// The rest of code is to save as RTF and close word
//
object saveFormat = WdSaveFormat.wdFormatRTF;
doc.SaveAs2000(ref outFile,ref saveFormat,ref Missing,ref Missing,
ref Missing,ref Missing,ref Missing,
ref Missing,ref Missing,ref Missing,ref Missing);
doc.Close(ref Missing,ref Missing,ref Missing);
app.Quit(ref Missing,ref Missing,ref Missing);
--------------------------------------------------------------------------------
This code fails to open files and msword.exe fails to close correctly.
Open() or OpenOld() returns null with no exceptions in IIS 7 (Vista), but
works fine in Desktop Applications or in IIS 6 (Win 2003).
I tried similar code in C++ and it also fails.
I tried also to put this code in a seperate exe and call it like this:
RTFConv.exe <inFile> <outFile>, but it also fails.

I want a solution for this problem or maybe another way for converting DOC
files to RTF from server side code on IIS 7.

Thanks,
Eslam Kamal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top