As starting from C # and using only C #, there is no contact with VB, only. NET, developers who have not used COM, and have been less aware of what is COM's ghost.
Now I see a chestnut in the book: A typical COM is the API for Word operations (personal understanding).
Public Static voidWordtest () {Application app=Newapplication {Visible =true }; App. Documents.Add (); Document Doc=app. ActiveDocument; Paragraph par=Doc. Paragraphs.add (); Par. Range.Text="hehe C # hellop"; stringfilename =AppDomain.CurrentDomain.BaseDirectory; Doc. SaveAs2 (FileName:Path.Combine (FileName,"demo.html"), FileFormat:WdSaveFormat.wdFormatFilteredHTML);
Doc. SaveAs2 (FileName:Path.Combine (FileName, "Demo.doc"), FileFormat:WdSaveFormat.wdFormatDocument97); Doc. Close (); App. Application.Quit (); }
The above is a static method that can be invoked using the console and generate a doc file and HTML file containing the text under the program's current path.
Environment: VS2013, added a reference to Microsoft.Office.Interop.Word, office2010 installed on the machine.
Use C # to invoke the interface of Word to generate a doc file with a htnl file