Hi,
I have an application which creates a quote in a word document and displays it to the screen.
The user has the option to go back to the application and enter another quote while Word is still open.
This resulted in an error that c# could not create the quote document as it was already open fair enough.
I used to kill the process, but it left temporary Word documents lying around and when you logged off, Word would ask you if you wanted to save each one or recover each one.
I solved this by finding the process and closing the open window before they generate a quote, as follows.
foreach ( Process p in processes )
{
if ( p.MainWindowTitle.IndexOf( "quote.doc" ) != -1 )
{
p.CloseMainWindow();
}
}
This works fine, until they print the document.
Then, when you close the document, you get a prompt asking if you want to save your changes, even though all that has happened is that the document has been printed!
Anyone with a suggestion to get around this ?
(I've thought of serialisng the documents, but this is going on laptops to salesmen and disk housekeeping would be a nightmare)
TIA
Regards,
Graham
I have an application which creates a quote in a word document and displays it to the screen.
The user has the option to go back to the application and enter another quote while Word is still open.
This resulted in an error that c# could not create the quote document as it was already open fair enough.
I used to kill the process, but it left temporary Word documents lying around and when you logged off, Word would ask you if you wanted to save each one or recover each one.
I solved this by finding the process and closing the open window before they generate a quote, as follows.
foreach ( Process p in processes )
{
if ( p.MainWindowTitle.IndexOf( "quote.doc" ) != -1 )
{
p.CloseMainWindow();
}
}
This works fine, until they print the document.
Then, when you close the document, you get a prompt asking if you want to save your changes, even though all that has happened is that the document has been printed!
Anyone with a suggestion to get around this ?
(I've thought of serialisng the documents, but this is going on laptops to salesmen and disk housekeeping would be a nightmare)
TIA
Regards,
Graham