Main Content

mlreportgen.utils.word class

Package: mlreportgen.utils

Interact with Microsoft Word and Word documents

Description

Use the static methods of the mlreportgen.utils.word class to interact interacting with the Microsoft® Word application and Word documents. These methods use the MATLAB® interface to the Microsoft .NET Framework to interact with Word.

The mlreportgen.utils.word class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Methods

expand all

Examples

collapse all

Suppose that the Word files, test.docx and test1.docx are in a folder named mydocs on the C: drive. Open the files using mlreportgen.utils.word.open.

wordDoc = mlreportgen.utils.word.open("test")
wordDoc1 = mlreportgen.utils.word.open("test1") 
wordDoc = 

  WordDoc with properties:

    FileName: "C:\mydocs\test.docx"


wordDoc1 = 

  WordDoc with properties:

    FileName: "C:\mydocs\test1.docx"

Suppose that the Word files test.docx and test1.docx are in a folder named mydocs on the C: drive and that you opened them using mlreportgen.utils.word.open.

Obtain the file names of the open Word document files by using mlreportgen.utils.word.filenames.

files = mlreportgen.utils.word.filenames()
files = 

  1×2 string array

    "C:\mydocs\test.docx"    "C:\mydocs\test1.docx"
Introduced in R2018b