Solved

Check Grammer using C#

Posted on 2014-10-19
2
111 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 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
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
Comment Utility
Very good Solution iam going to close the question ..

Thank you...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

11 Experts available now in Live!

Get 1:1 Help Now