Documentation

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.

docview

View a document using Word

Syntax

[status,message] = docview(filename)
[status,message] = docview(filename,option)
[status,message] = docview(filename,option1...optionN)

Description

example

[status,message] = docview(filename) opens the specified file as a Word document. Returns success or failure and, if appropriate, an error message. This command can then use Word to perform operations such as printing the document, updating table of contents and page numbers, and converting the document to PDF.

Note

On Linux and Macintosh platforms, the report output displays in Apache OpenOffice™, which must be installed in /Applications/OpenOffice.app.

example

[status,message] = docview(filename,option) operates on the file using the specified criterion.

example

[status,message] = docview(filename,option1...optionN) uses one or more additional criteria.

Examples

collapse all

Open a document in RTF format in Word. This example assumes the document magic-squares.rtf is on the MATLAB® path.

docview('magic-square.rtf');

Print a document. This example assumes the document mydoc.doc is on the MATLAB path.

docview('mydoc.doc','printdoc');

Use docview to update TOC fields in a document, convert the document to PDF, and close a Word document. This command creates the document mytocdoc.pdf in the current folder. This example assumes the document mytocdoc.docx is on the MATLAB path.

docview('mytocdoc','updatedocxfields','convertdocxtopdf','closeapp');

Input Arguments

collapse all

Name of file to view, print, or update, specified as the full path name.

Additional criteria for viewing the file, specified as one of these values:

  • 'updatefields' — Update fields, such as the TOC.

  • 'updatedocxfields' — Update fields in a DOCX document.

  • 'convertdocxtopdf' — Convert a DOCX document to PDF. Use this option only with Microsoft® Office on a Windows® system.

  • 'showdocxaspdf' — Convert a DOCX document to PDF and open in a PDF viewer. Use this option only with Microsoft Office on a Windows system.

  • 'unlinkdocxsubdoc' — Replace links to other documents with the content of those documents. Use this option only with Microsoft Office on a Windows system. To learn about subdocuments, see mlreportgen.dom.DOCXSubDoc.

  • 'printdoc' — Print the document.

  • 'closeapp' — Close Word after completing all other actions. Enter this option after the other options.

Data Types: char

Output Arguments

collapse all

Success status of the specified actions, returned as 0 when the action was not completed and 1 for success.

Error or warning information, returned as a character vector.

Introduced before R2006a

Was this topic helpful?