S
sudha
Hi,
To open a word doc from c#, i use the following code :
Word.ApplicationClass WordApp = new Word.ApplicationClass
();
// give any file name of your
choice.
object fileName = "C:\\test.doc";
object readOnly = false;
object isVisible = true;
// the way to handle parameters
you don't care about in .NET
object missing =
System.Reflection.Missing.Value;
// Make word visible, so you can
see what's happening
//WordApp.Visible = true;
// Open the document that was
chosen by the dialog
Word.Document aDoc =
WordApp.Documents.Open(ref fileName,
ref missing,ref readOnly,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref
isVisible);
While executing, Wordapp.Documents.Open..it stops with the
following message :
A first chance exception of
type 'System.InvalidCastException' occurred in AdoDemo1.exe
Additional information: QueryInterface for interface
Word._Application failed.
Can anyone help to overcome the above error message.
Thanks
sudha
To open a word doc from c#, i use the following code :
Word.ApplicationClass WordApp = new Word.ApplicationClass
();
// give any file name of your
choice.
object fileName = "C:\\test.doc";
object readOnly = false;
object isVisible = true;
// the way to handle parameters
you don't care about in .NET
object missing =
System.Reflection.Missing.Value;
// Make word visible, so you can
see what's happening
//WordApp.Visible = true;
// Open the document that was
chosen by the dialog
Word.Document aDoc =
WordApp.Documents.Open(ref fileName,
ref missing,ref readOnly,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref missing,
ref missing,
ref missing, ref
isVisible);
While executing, Wordapp.Documents.Open..it stops with the
following message :
A first chance exception of
type 'System.InvalidCastException' occurred in AdoDemo1.exe
Additional information: QueryInterface for interface
Word._Application failed.
Can anyone help to overcome the above error message.
Thanks
sudha