sachin kulkarni
sachin kulkarni

Reputation: 2828

Reading 2010 Word File

I have added a reference to Microsoft.Office.Interop.Word 12.0.0.0. I have Visual Studio 2008 and Microsoft Word 2010(Starter).

string filePath = @"C:\PP.docx";
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.ApplicationClass();

// create object of missing value
object miss = System.Reflection.Missing.Value;

// create object of selected file path 
object path = filePath;

// set file path mode 
object readOnly = false;

// open document                 
Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);

// select whole data from active window document
docs.ActiveWindow.Selection.WholeStory();

// handover the data to cllipboard 
docs.ActiveWindow.Selection.Copy();

// clipboard create reference of idataobject interface which transfer the data
System.Windows.Forms.IDataObject data = Clipboard.GetDataObject();

I get the error mentioned below:

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154. at Microsoft.Office.Interop.Word.Application word => new Microsoft.Office.Interop.Word.ApplicationClass();

Thanks, Sachin K

Upvotes: 0

Views: 1032

Answers (1)

Dirk Vollmar
Dirk Vollmar

Reputation: 176159

The Office Starter 2010 edition is limited and does not support automation.

You need to get an appropriate full Office suite (e.g. the Professional edition).

For more information about the limitations see http://www.microsoft.com/oem/en/products/office/pages/office_2010_starter.aspx

Upvotes: 1

Related Questions