Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
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 19-Feb-13 23:39pm
Comments
Garth J Lancaster at 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 at 20-Feb-13 6:22am
   
refer this link
 
http://www.mindstick.com/Articles/5cd1b721-9b94-4ea0-bd6e-2bb157401069/
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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".
//Example
Microsoft.Office.Interop.Word.Application Doc = new Microsoft.Office.Interop.Word.Application();
Application Interface[^]
Microsoft.Office.Interop.Word Namespace[^]
 
hope it helps.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

About the error type 2.
 
Please check if the invoked dll property "Embedd Interop" is changed as "false".
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Use this C# Library for MS Word , it use C# language to read, create modify and even convert your doc or docx file to many other formats. I hope this API will solve your problem.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

<a href=""></a>[<a href="" target="_blank"></a>]<
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

just add this reference "System.IO.File"
then write
File.ReadAllText(@"Path");
This will read all your text from the document
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 9,935
1 OriginalGriff 6,987
2 CPallini 5,845
3 George Jonsson 4,015
4 Gihan Liyanage 3,266


Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 1 Feb 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100