2

One of my coworkers wrote a .NET windows service that converts .doc to .docx files. In order to accomplish that goal, he uses wordconv.exe which comes with the office 2007 compatibility pack.

Most times everything works fine, but under certain circumstances wich we weren't able to reproduce yet, wordconv.exe doesn't convert, but returns exitcode -14.

Unfortunately, this error only occurs in our customers production environment. We weren't able to reproduce the error in the development or integration system.

We're using the following code:

Process converter = new Process();
converter.StartInfo.FileName = <Path to wordconv.exe>;
converter.StartInfo.Arguments = string.Format("-oice -nme \"{0}\" \"{1}\"", fileIn, fileOut);
converter.StartInfo.CreateNoWindow = true;
converter.StartInfo.WindowStyle = ProcessWindowStyle.hidden
converter.StartInfo.UseShellExecute = false;
converter.StartInfo.RedirectStandardError = true;
converter.StartInfo.RedirectStandardOutput = true;
converter.Start();
converter.WaitForExit(intervall);
int exitCode = converter.ExitCode;
Andre Kraemer
  • 2,633
  • 1
  • 17
  • 28

3 Answers3

3

Ok, we just found the problem. Our customer saved docx files with a doc extension. Later they tried to convert this docx to docx. Using the GUI of the office compatiblity pack everything worked fine. Even Word opened the "faked" doc file without a warning message.

Andre Kraemer
  • 2,633
  • 1
  • 17
  • 28
  • 1
    This helped me to realise that my document was just a .txt file that had a .doc extension. The conversion failed and there was no further info. – David d C e Freitas Mar 09 '15 at 20:34
1

Can you tie the problem to specific input documents?

If you can't can you make sure that there is always only a single instance of wordconv.exe running?

It might be that several processes in parallel might not be supported (I'm just wildly guessing; we have a service basically doing the same call but we haven't faced such a problem yet).

Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316
  • Thanks for your suggestion! The problem occurs with different documents. All of them can easily be convertet later. I think that we're running multiple converter processes in parallel. I'll check if that's the reason for our problem! – Andre Kraemer Jul 06 '09 at 06:46
0

I wonder whether wordconv is suffering the same fate as the rest of Office - i.e. not supported in a service application. As such, freaky things may happen...

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • Thank's for your answer! I think / hope that this isn't the problem because we're not doing any com automation, but just some "command line style" calls. However, I'll research that! – Andre Kraemer Jun 22 '09 at 13:15
  • 1
    But what does wordconv do internally...? – Marc Gravell Jun 22 '09 at 13:21
  • As it works without an installed copy of ms office I hope, that it doesn't do any office com automation magic ;-) – Andre Kraemer Jun 22 '09 at 13:39
  • OK - fair enough. It sounds like this isn't the issue, then. Sorry for adding confusion, but I think it was at least worth investigating. – Marc Gravell Jun 22 '09 at 14:01
  • 1
    It doesn't require an installed version of Office, but Compatibility Pack itself installs quite a bit, e.g. mso.dll which is a core component of Office. – Dirk Vollmar Jul 01 '09 at 20:29