Main Content

mlreportgen.dom.Document.getOPCMainPart

Class: mlreportgen.dom.Document
Namespace: mlreportgen.dom

Return main part of document, document part, or template

Description

partOut = mlreportgen.dom.Document.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 = mlreportgen.dom.Document.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

expand 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

expand 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

expand 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.

Version History

Introduced in R2014b