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.

mlreportgen.dom.Document.getOPCMainPart

Package: mlreportgen.dom

Return main part of document, document part, or template

Syntax

partOut = getOPCMainPart(path)
partOut = getOPCMainPart(path,docType)

Description

partOut = getOPCMainPart(path) returns the path of the main part (file) of a package for a document, document part, or template, based on the specified path. The returned path is relative to the root directory of the package, which is symbolized by a forward slash (/). The main part is the file that contains the document or template XML or HTML markup.

example

partOut = getOPCMainPart(path,docType) returns the relative path of the main part of the output package of the specified type (Microsoft® Word or HTML) of document, document part, or template.

Examples

collapse all

The example returns the path to the main part of an HTML document named myDoc.htmx. The main part is named root.html, which is in the top-level folder of the package.

import mlreportgen.dom.*;
myDocument = Document('myDoc','html');

append(myDocument,'Hello world');

close(myDocument);
mlreportgen.dom.Document.getOPCMainPart('MyDoc.htmx','html')
ans =

/root.html

Input Arguments

collapse all

If you use the path argument without the docType argument, include the .docx or .htmx extension.

If you use both the path and docType arguments, getOPCMainPart appends an extension of the appropriate type (.docx or .htmx).

Type of document, document part, or template, specified as a character vector.

Output Arguments

collapse all

The path to the main part of the document, document part, or template. The returned path is relative to the root directory of the package, which is symbolized by a forward slash (/).

Tips

The getOPCMainPart method is a static method. Invoke it on the Document class, rather than on an instance of the Document class or on a class derived from the Document class.

Introduced in R2014b

Was this topic helpful?