2
Answers

how to work with word docs???

Photo of ariangoodwin

ariangoodwin

20y
2.9k
1
I am beginning my first major project creating software that in part must deal with importing information from .doc files, and possibly export information to .doc files. I know nothing about this, and I'm wondering where to start as far as learning the in's and out's of manipulating .doc files from c# The software is for creating, proctoring, and taking exams, and some things it must do are: *be able to import a word document that may contain images *be able to parse a word document for test questions it contains *be able to export a graph of the test results to a word document *stuff I haven't thought of yet... Could anyone point me in the right direction as far as articles, books, even just the classes I might use for manipulating .doc files??? Thanks! Arian Goodwin

Answers (2)

0
Photo of sfsunk
NA 3 0 20y
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
Photo of jcity444
NA 286 0 20y
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.