Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I’m a student currently doing my final year project which I need to develop a examination paper system to facilitate setting of exam paper. So after teacher upload word document (examination paper) to the system. I want to have a api which can help to check grammar and spelling before the director sees the paper. So that he/she only need to focus on whether the question is suitable or not.

What I have tried:

I try to find on internet but most of the api checking for only string not a whole word document.
Posted
Updated 10-Mar-20 4:10am

1 solution

Perhaps reading/working/researching with the documentation would be of assistance:
_Document.CheckGrammar Method
Begins a spelling and grammar check for the specified document or range.
Remarks
If the document or range contains errors, this method displays the Spelling and Grammar dialog box (Tools menu), with the Check grammar check box selected. When applied to a document, this method checks all available stories (such as headers, footers, and text boxes).
Reference:
_Document.CheckGrammar Method (Microsoft.Office.Interop.Word) | Microsoft Docs[^]
Microsoft Support:
"Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment."
https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office[^]

There really is no simple way to do this, as all of the functions that you would be calling generate modal windows that don't work to well when there is no one working on the server which is where the application is opening up.

Now there is OneDrive and/or Office365 which may allow you to embed an instance within a website; you may want to look at the complexity of that and see if it is worth it.
 
Share this answer
 
v2
Comments
Dave Kreskowiak 10-Mar-20 11:59am    
This can NOT be used in a web (ASP.NET) application.
xiaotuziyi 10-Mar-20 19:00pm    
Is it because of it is using c++? I checked the line of code is c++.
Dave Kreskowiak 10-Mar-20 19:04pm    
No, it's because Office Interop is not supported in service applications, like Windows Services and web applications.
MadMyche 10-Mar-20 19:47pm    
As for the language... there is a filter at the top right of the page where you can choose C++, C# or VB
MadMyche 11-Mar-20 7:27am    
Updated solution to reflect this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900