I'm using ColdFusion 7 on a Windows 2003 server to talk to a default installation of Microsoft Word 2000 using COM objects. The goal is to generate a document with some tables in it.
That much I'm able to do. The CPU spikes to 100% for the duration, but my code is functional and if it's short, it works. The problem I'm encountering is when the code used to generate the Word document gets to be about 25kb+ (a script is generating lots of repetitious code).
After the server spends 1 minute 40 seconds trying to generate the document:
- CPU usage drops to 0 (CPU was split between jrun.exe for ColdFusion and winword.exe for Word 2000).
- winword.exe remains in memory.
- ColdFusion's timeout is long, so the client browser thinks the page is still processing, however...
- If I kill the winword.exe process, ColdFusion immediately returns an error to the client.
So these longer pages never finish. I've tried many variations.
- ColdFusion 8 doesn't work.
- Using an updated JVM for ColdFusion 7/8 doesn't work.
- The content of the code I'm running makes no difference. I'm doing a lot of fancy table coloring, but a million lines of "Hello world" also dies.
- A trial of Word 2007, amazingly, does work. The formatting is a little wonky, since it defaults to Calibri and the other new fonts, but the server will wait up to, say, 7 minutes until it's complete. And then reboot the server, try and execute the same code, and Word 2007 insists it doesn't understand any command I send it. I've done the trial activation, I've even started Word 2007 using remote desktop after the reboot. Word goes completely catatonic after that first restart.
What I haven't tried:
- Word 2003
My net searches were fruitless beyond "here's how to connect to Word's API" in ColdFusion land and "here's how to put the page count in the footer" in ASP.NET land. It seems nobody using Adobe's stuff is trying to do this, and nobody using Microsoft's stuff is having my problem. And so I toss myself on your shores, bleeding and malnourished, seeking some insight into this maddening timeout problem.
Here's what a snippet of the ColdFusion code looks like:
<cfset clientMatterCellStart = myDoc.Tables.Item(1).Cell(2,1)>
<cfset clientMatterCellEnd = myDoc.Tables.Item(1).Cell(2,7)>
<cfset clientMatterCellStart.Merge(clientMatterCellEnd)>
<cfset clientMatterCellStart.Range.Font.Bold = true>
<cfset clientMatterCellStart.Range.Font.Name = "Times New Roman">
<cfset clientMatterCellStart.Range.Font.Size = 14>
<cfset clientMatterCellStart.Range.ParagraphFormat.Alignment = 1><!--- Centered --->
<cfset clientMatterCellStart.Range.Text = "#MySubjects.subject_name[q]#">
<cfset clientMatterCellStart.Shading.BackgroundPatternColor = 13421772><!--- Grey 20% --->