Forum Moderators: open
What I want to do is quite simple. I want to run a script (don't mind what type) that will convert .doc files which are stored on my asp windows server to .txt files. It must be done on the server and by the server, in other words, I don't want to be downloading the files locally and executing batch processes.
This must be possible. After all, you can do anything with Access database files on Windows server! Why not its Office sister - Word!
I'm so desperate to do this I'm prepared to hear how this can be done on Apache/UNIX servers too - I may switch if it it only possible on that platform!
As I said, any language script is OK...
Any help here, would be much much appreciated.
The biggest problem, you will find is terminating the instance of Word you just created. Big bad memory leak problems since it runs out of process. Below is the only stable way I was able to do it, mind you I was doing it in a .NET service, not inside IIS. The attempts made in VB6 (read ASP) failed because of memory problems. I've pasted some .NET code samples below.
Dim oWord As Word.ApplicationClass
Dim oDoc As Word.DocumentClass
oWord = New Word.ApplicationClass()
oDoc = New Word.DocumentClass()
oDoc = oWord.Documents.Open("C:\FileToOpen.doc")
oDoc.SaveAs("C:\MyFile.txt", wdFormatText) 'Here's where you can specify format
oDoc.Close
oWord.Quit
oDoc = Nothing
oWord = Nothing
Good luck, it's a messy situation to be in. Glad I don't support that application any more ;)