Click here to Skip to main content
15,922,584 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Colour Format (Please help) Pin
Guffa3-Jul-05 13:23
Guffa3-Jul-05 13:23 
GeneralRe: Colour Format (Please help) Pin
fakefur3-Jul-05 15:33
fakefur3-Jul-05 15:33 
GeneralRe: Colour Format (Please help) Pin
Guffa4-Jul-05 1:47
Guffa4-Jul-05 1:47 
GeneralPer-user web directories in IIS Pin
Adam Durity30-Jun-05 8:44
Adam Durity30-Jun-05 8:44 
Generaldynamic tree structure table (jscript & xml) Pin
minette30-Jun-05 1:19
minette30-Jun-05 1:19 
Generaljavascript Pin
Anonymous30-Jun-05 0:52
Anonymous30-Jun-05 0:52 
GeneralRe: javascript Pin
Guffa30-Jun-05 2:14
Guffa30-Jun-05 2:14 
GeneralWord 2003 automation problem in web service Pin
hrdegroot29-Jun-05 20:36
hrdegroot29-Jun-05 20:36 
Hi,

In my Web application, I use Word 2003 automation to convert .doc files to .html files.
The problem is, this conversion only runs once. It appears to run correctly: Word starts, converts and closes. The second time it runs, an error occurs (0x800a1066), and the WINWORD.EXE process does not quit. Actually, each failed conversion starts a new WINWORD.EXE process. Only a reboot can clean up this mess, just killing the processes is not enough.

I tried changing the visibility to true, then to false, to no effect. I tried providing the calls with explicit parameters (in stead of 'missing'), that also did not work. I also tried explicitly releasing the COM objects (as suggested in a Microsoft KB article), but you can guess what happened..

When I copy the exact piece of code to a stand-alone console application (that quits when it's done), then start this application in a separate process from my web application, all runs well!! I would never see this as a permanent solution, though, the automation should just work from the web application.

Maybe someone has an idea?

Here's the code:
<br />
private static void save_word_as_html(string word_file, string html_file)<br />
{<br />
	object objMissing = System.Reflection.Missing.Value;<br />
	object FileOpen = (object)word_file;<br />
	object FileSave = (object)html_file;<br />
	object objSaveFormat = (object)WdSaveFormat.wdFormatFilteredHTML;<br />
	object objOpenFormat = (object)WdOpenFormat.wdOpenFormatAuto;<br />
	object objNoSave = (object)WdSaveOptions.wdDoNotSaveChanges;<br />
	object objTrue = (object)true;<br />
	object objFalse = (object)false;<br />
<br />
	Exception retEx = null;<br />
<br />
	Word.Application wordApp = null;<br />
	_Document doc = null;<br />
<br />
	if (m_app == null)<br />
		m_app = new Word.ApplicationClass();<br />
	wordApp = m_app;<br />
<br />
	Word.Documents docs = wordApp.Documents;<br />
<br />
	try <br />
	{<br />
		wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;<br />
		wordApp.Visible = false;<br />
<br />
		doc = wordApp.Documents.Open(ref FileOpen,ref objFalse,ref<br />
			objTrue,ref objFalse,ref objMissing,ref objMissing,ref objFalse,ref<br />
			objMissing,ref objMissing,ref objOpenFormat,ref objMissing,ref objFalse,ref <br />
			objFalse,ref objMissing,ref objTrue,ref objMissing); <br />
<br />
		doc.SaveAs(ref FileSave, ref objSaveFormat,ref objFalse,ref<br />
			objMissing,ref objFalse,ref objMissing,ref objFalse,ref objMissing,ref<br />
			objMissing,ref objMissing,ref objMissing,ref objMissing,ref objMissing,ref<br />
			objMissing, ref objMissing, ref objMissing);<br />
<br />
	} <br />
	catch (Exception E) <br />
	{<br />
		retEx = E;<br />
	}<br />
<br />
	try <br />
	{<br />
		doc.Close(ref objNoSave,ref objMissing,ref objMissing);<br />
		NAR(doc);<br />
		docs.Close(ref objNoSave,ref objMissing,ref objMissing);<br />
		NAR(docs);<br />
		wordApp.Quit(ref objNoSave,ref objMissing,ref objMissing);<br />
		NAR(wordApp);<br />
	} <br />
	catch (Exception) {}<br />
<br />
	GC.Collect();<br />
	GC.WaitForPendingFinalizers();<br />
<br />
	if (retEx != null)<br />
		throw retEx;<br />
}<br />
<br />
private static void NAR(object o)<br />
{<br />
	try<br />
	{<br />
		System.Runtime.InteropServices.Marshal.ReleaseComObject(o);<br />
	}<br />
	catch {}<br />
	finally<br />
	{<br />
		o = null;<br />
	}<br />
}<br />

QuestionHow to resize a web page ? Pin
rushing29-Jun-05 19:47
rushing29-Jun-05 19:47 
Generaljavascript Pin
cmarmr29-Jun-05 6:48
cmarmr29-Jun-05 6:48 
GeneralRe: javascript Pin
StylezHouse29-Jun-05 7:44
StylezHouse29-Jun-05 7:44 
GeneralRe: javascript Pin
cmarmr29-Jun-05 8:06
cmarmr29-Jun-05 8:06 
GeneralRe: javascript Pin
Guffa29-Jun-05 8:43
Guffa29-Jun-05 8:43 
GeneralRe: javascript Pin
cmarmr29-Jun-05 14:30
cmarmr29-Jun-05 14:30 
GeneralRe: javascript Pin
Guffa30-Jun-05 2:23
Guffa30-Jun-05 2:23 
GeneralProblem in setting the Date using Calendar control Pin
just4ulove729-Jun-05 4:38
just4ulove729-Jun-05 4:38 
GeneralRe: Problem in setting the Date using Calendar control Pin
Christian Graus29-Jun-05 11:58
protectorChristian Graus29-Jun-05 11:58 
GeneralRe: Problem in setting the Date using Calendar control Pin
just4ulove729-Jun-05 12:08
just4ulove729-Jun-05 12:08 
GeneralRe: Problem in setting the Date using Calendar control Pin
Christian Graus29-Jun-05 12:16
protectorChristian Graus29-Jun-05 12:16 
GeneralRe: Problem in setting the Date using Calendar control Pin
just4ulove729-Jun-05 12:21
just4ulove729-Jun-05 12:21 
GeneralRe: Problem in setting the Date using Calendar control Pin
Christian Graus29-Jun-05 12:36
protectorChristian Graus29-Jun-05 12:36 
GeneralRe: Problem in setting the Date using Calendar control Pin
just4ulove729-Jun-05 12:47
just4ulove729-Jun-05 12:47 
GeneralRe: Problem in setting the Date using Calendar control Pin
Christian Graus29-Jun-05 13:01
protectorChristian Graus29-Jun-05 13:01 
GeneralRe: Problem in setting the Date using Calendar control Pin
just4ulove729-Jun-05 13:02
just4ulove729-Jun-05 13:02 
GeneralWeb Development Pin
Anonymous29-Jun-05 4:09
Anonymous29-Jun-05 4:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.