Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
4.00/5 (1 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 ! :-?

Hi,

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

Regards
Robert
 
Share this answer
 
The Open method takes 16 parameters. Take a look at the MSDN[^] page for this.
 
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