Microsoft office word interop. The index number represents the position of the document in the documents collection. Sets the placeholder text that displays in the content control until a user enters their own text. On the assemblies page select microsoftofficeinteropword in the component name list and then hold down the ctrl key and select microsoftofficeinteropexcel. Use the page object and the related methods and properties for programmatically defining page layout in a document.
Reserved for internal use. In this article public interface class page. Add the microsoftofficeinteropword assembly to your project. Represents a page in a document.
Use documents index where index is the document name or index number to return a single document object. To use the features of a microsoft office application from an office project you must use the primary interop assembly pia for the application. Microsoft word can be used with c code. With the microsoftofficeinteropword assembly we get the contents and formatting from the document.
The pia enables managed code to interact with a microsoft office applications com based object model. Install office primary interop assemblies. In visual studio click clean solution on the build menu to clean up the completed project. Public void setplaceholdertext microsoftofficeinteropwordbuildingblock buildingblock default microsoftofficeinteropwordrange range default string text.
The documents collection contains all the document objects that are currently open in microsoft word. Because the application references the excel and word pias and the embed interop types property is set to false both assemblies must exist on the end users computer. The microsoft office 2010 primary interop assemblies pia redistributable is a microsoft windows installer package that contains the primary interop assemblies for microsoft office 2010 products. If you do not see the assemblies you may need to ensure they are installed and displayed.