Solved

Check Grammer using C#

Posted on 2014-10-19
2
119 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 49

Accepted Solution

by:
Rgonzo1971 earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now