Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Error 2 Interop type 'Microsoft.Office.Interop.Word.ApplicationClass' cannot be embedded. Use the applicable interface instead. C:\Projects\EmployeSoftwareProject\EmployeSoftwareProject\Retrivewordfile.cs 49 100 EmployeSoftwareProject
Error 1 The type 'Microsoft.Office.Interop.Word.ApplicationClass' has no constructors defined C:\Projects\EmployeSoftwareProject\EmployeSoftwareProject\Retrivewordfile.cs 49 66 EmployeSoftwareProject

i have implementing Reading a word document using C# i got above errors any one help what am wrong..
Posted
Updated 20-Aug-17 19:41pm
Comments
Garth J Lancaster 20-Feb-13 6:05am    
it might help if you show some code - or otherwise show us how you're using Microsoft.Office.Interop....
Azziet 20-Feb-13 6:22am    
refer this link

http://www.mindstick.com/Articles/5cd1b721-9b94-4ea0-bd6e-2bb157401069/

just add this reference "System.IO.File"
then write
File.ReadAllText(@"Path");

This will read all your text from the document
 
Share this answer
 
<a href=""></a>[<a href="" target="_blank"></a>]<<big><small></small></big>
 
Share this answer
 
About the error type 2.

Please check if the invoked dll property "Embedd Interop" is changed as "false".
 
Share this answer
 
Hi,

this error generally occurs if you are trying to create object of "Microsoft.Office.Interop.Word.ApplicationClass" class. so, rather creating object of ApplicationCLass, create object of "Application", i.e, "Microsoft.Office.Interop.Word.Application".
C#
//Example
Microsoft.Office.Interop.Word.Application Doc = new Microsoft.Office.Interop.Word.Application();

Application Interface[^]
Microsoft.Office.Interop.Word Namespace[^]

hope it helps.
 
Share this answer
 

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