hello
I want to write a program that will read word document file, in c#? it has to read string (lines) in word document, split into words. this words fill in excel row(each word in separate cell with count of character in that word) restriction for some special characters.
e.g. Hello, welcome to the c sharp programming.
Hello 5 welcome 7 to 2 the 3 c 1 sharp 5programming 11
here comma not allowed.
Thank you in advance..
Anuradha Chavan
[email protected]
Loading
VulpesPosted Jan 5, 2014, 11:53 AM
http://www.excelforum.com/excel-programming-vba-macros/514832-how-to-read-a-line-from-ms-word.html
So I've translated the VB Script to C# and included it in the program.
I've also dealt with the other aspects you described in your latest post:
Please note the following:
There are some inconsistencies between the ProblemFile and the RequiredSolution files. For example (not necessarily exhaustive):
(a) The Excel file has 'XXXI hours' but the word file has 'a hour'.
(b) The Excel file suppresses all opening single quotes but not closing single quotes.
(c) The Excel file doesn't include the blank lines and then the formatting instruction at the end of the Word file.
(d) The Excel file treats: anything –' as a single word even though, in the Word file, there's a space between anything and the dash.
My program sticks rigidly to the rules in all these cases.
Notice also that the program attempts to parse every word to what would be regarded as a valid Roman numeral in modern times. This means that the only symbols recognized are I,V,X,L,C,D and M and four of these symbols together such as IIII is regarded as invalid (IV should be used instead).
There are a few cases where valid Roman numerals are also valid English words such as 'mix'.
In such cases the program assumes it's a Roman numeral rather than a word and so returns a count of 4 (i.e. 1009) not 3.
VulpesPosted Jan 2, 2014, 7:55 PM
However, you can get individual sentences or paragraphs.
I've used sentences in the following code (requires C# 4.0 or later). You need to add references to both the Word and Excel object libraries to your project: