Click here to Skip to main content
14,450,208 members
Rate this:
Please Sign up or sign in to vote.
See more:
here is my code

public string Test(string path)
    {
        Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
        object file = path;
        object nullobj = System.Reflection.Missing.Value;

        Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj,
                                               ref nullobj, ref nullobj, ref nullobj,
                                               ref nullobj, ref nullobj, ref nullobj,
                                               ref nullobj, ref nullobj, ref nullobj);

        string result = doc.Content.Text.Trim();
        doc.Close();
        return result;
    }


and the error is as following:
Error	2	No overload for method 'Open' takes '12' arguments
Error	3	No overload for method 'Close' takes '0' arguments
Posted
Comments
Amir Mahfoozi 25-Jan-12 7:31am
   
I tested your provided code exactly and it runs without any error ! :-?
Rate this:
Please Sign up or sign in to vote.

Solution 1

The Open method takes 16 parameters. Take a look at the MSDN[^] page for this.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Hi,

try to check following link:
http://omegacoder.com/?p=555[^]

Regards
Robert
   

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




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