0
Hi Arian:
I think i am now doing the similar project as yours. I have spend all the time to search marterials for word manipulating till now today. But saddly no good news.
In my project ,i will have to read text from one word document,and then copy them to another document .Maybe will do some conversion with the text. And copying picture and table is also needed.
Here is my test program:
1. the Environment
Windows 2000,vs.net 2003,office 2000,pia for xp.
Here is a question when i install pia:after i execute the register.bat file,there should be "Microsoft Word 10.0 Object Library" entry in the list of COM type libraries. But still no.
So i have to use the original one which alrady exists:Microsoft Word9.0 Object Library.
2,Here is the main part of the code:
--------------------------------
Word.ApplicationClass wordApp=new Word.ApplicationClass();
wordApp.Visible=true;
object fileName = @"c:\1.doc";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
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);
aDoc.Activate();
wordApp.Selection.TypeText("Copyright C# Corner");
wordApp.Selection.TypeParagraph();
But it always run out an exception:System.InvalidCastException, QueryInterface faliure.
------------------------------------------
So did you encounter these problems? If you have interest ,we can communicate in deep ,Thanks!
My Email:sfsunk@tom.com

0
Hi Arian,
Go to the Search on this site and type in microsoft word. You'll see a few articles that will come up to get you started. (such as
www.c-sharpcorner.com/Code/2002/Mar/WordFromDotNet.asp
-Mike G.