Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Check Grammer using C#

Posted on 2014-10-19
2
Medium Priority
?
144 Views
Last Modified: 2014-11-18
How to check grammer in a paragraph using C# Office.Interop.word.
Please give example.
0
Comment
Question by:mannevenu26
2 Comments
 
LVL 53

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 40391481
Hi,

pls try

using System;
using Word =  Microsoft.Office.Interop.Word;

class Program
{
    static void Main()
    {



        //int myErrors = 0;
        // Open a doc file.
        object oMissing = System.Reflection.Missing.Value;


        Word.Application application = new Word.Application();


        application.Visible = true;
        Word.Document document = application.Documents.Open("\\\\chca6037.eur.beluni.net\\a853725$\\Documents\\Forms.docx");
        //Microsoft.Office.Interop.Word.Document doc = new Microsoft.Office.Interop.Word.Document();
        int IdxPara = 0;
        foreach (Word.Paragraph parag in document.Paragraphs)
        {
            Word.Range parRng   = parag.Range;
            int myErrors = 0;
            IdxPara++;
            myErrors = parRng.GrammaticalErrors.Count;
            if (myErrors > 0)
            {
                Console.WriteLine("Paragraph {1} has {0} error(s)", myErrors, IdxPara);
            }
            else
            {
                Console.WriteLine("Paragraph {0} has no error(s)",IdxPara);
            }
        }
        document.Close(false);
        application.Quit();
    }

Open in new window

Regards
0
 

Author Comment

by:mannevenu26
ID: 40432528
Very good Solution iam going to close the question ..

Thank you...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question