![]() ((_Application)word).Quit(ref oMissing, ref oMissing, ref oMissing) word has to be cast to type _Application so that it will find ((_Document)doc).Close(ref saveChanges, ref oMissing, ref oMissing) Object saveChanges = WdSaveOptions.wdDoNotSaveChanges ![]() ![]() doc has to be cast to type _Document so that it will find the Close the Word document, but leave the Word application open. Ref oMissing, ref oMissing, ref oMissing, ref oMissing, Ref fileFormat, ref oMissing, ref oMissing, Object fileFormat = WdSaveFormat.wdFormatPDF Object outputFileName = (".doc", ".pdf") Ref oMissing, ref oMissing, ref oMissing, ref oMissing) Ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, Use the dummy value as a placeholder for optional argumentsÄocument doc = (ref filename, ref oMissing, Object filename = (Object)wordFile.FullName Get list of Word files in specified directoryÄirectoryInfo dirInfo = new wordFiles = dirInfo.GetFiles("*.doc") C# doesn't have optional arguments so we'll need a dummy value Create a new Microsoft Word application object But it is better to use some managed library like Aspose using
0 Comments
Leave a Reply. |