Recently working on a project that has a technical challenge: "Extract data from a specified cell in the specified table in Word." This is a very, very big challenge for a student like me who just knows a little about C # syntax.
Login to Google, I have retrieved quite a few articles from more than 500 lines of code to less than 100 lines of code. These data extraction methods are basically a few, these people on the blog basically you copy me, I copy you. Now some of the authors are very irresponsible, take a piece of code to put it up. By going through the code, you will find that there are places where the author's custom classes are used, but the author does not provide you with the implementation of these classes. Such an author is very irritating! Some authors, on their own blog, have hundreds of lines of code, plus a title is over. What does the code mean, the program's entire implementation process is what it looks like, said not to say. The code is so much that no one is bothered to see it. A few incisive articles, I cream, after a few weeks of search and screening, and finally sorted out a set of feasible solutions. This article uses a simple example to uncover how to extract the specified cell data from the table in Word.
Preparatory work:
New Word document Doc1.doc. Draw the table and insert the data in the table, as shown in the following table:
Interface design and program running process screen screenshot:
Description: Opens a file by opening a button (displaying the file path in a TextBox control)
Open the file you just created Doc1.doc
Reads the 1th column of data in the second row, which is displayed in the TextBox control.