This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Work with Microsoft Word Documents Using .NET

This example uses classes from the Microsoft.Office.Interop.Word.ApplicationClass class. For information about the class and using the interface with different versions of Microsoft® Word, refer to documentation on the MSDN® website

The following code creates a new Word document:

wordApp = Microsoft.Office.Interop.Word.ApplicationClass;
wordDoc = wordApp.Documents;
newDoc = Add(wordDoc);

If you want to type directly into the document, type the MATLAB® command:

wordApp.Visible = true;

Put the cursor into the document window and enter text.

To name the document myDocument.docx and save it in the My Documents folder, type:


When you are finished, to close the document and application, type:


Related Topics

External Websites

Was this topic helpful?