Message filter shows a solution for displaying that the application is in use (Word operation, non-component permission issues)

Source: Internet
Author: User

You are writing a Word operation. One of the operations is to export data tables. The code is okay at the beginning, but when the amount of data is too large to be exported, the error "message filter shows that the application is in use" is reported, which makes me puzzled. Check the code repeatedly to make sure the code is correct. So I went online to find a solution. However, all the information on the Internet is about access denial errors caused by component permission issues. This error occurs occasionally when I operate the Word. Normally, this error is reported only when the data volume is large. So I think it's weird.

If you want to think about it, there is only one kind of problem that may cause this problem, that is, other programs are occupying the process of accessing the Word or Word I operate on. But what is it. After I tried it several times, I understood it. Now let's talk about the root cause of this problem:

The reason is: word spelling check

After I insert a large amount of data into the Word, a large number of spelling errors are detected in the automatic spelling check of the Word. Therefore, a prompt box is displayed, prompting users to have too many spelling errors. In our program, Word is run in the background, so the program does not know that Word plays a dialog box. When the program continues to insert data into the Word, because the Word process is blocked in the Word dialog box, the message filter displays the application in use error.

It is easy to solve the problem after knowing the root cause:

Reference Microsoft. Office. Interop. Word. dll

Word. Application word = new Word. ApplicationClass ();

Word. Document doc = word. Documents. Add (ref missing, ref missing );

Doc. SpellingChecked = false;

Doc. ShowSpellingErrors = fase;

Close the Word spelling check.

Solve the problem OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.