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.DOCXSubDoc class

Package: mlreportgen.dom
Superclasses:

Reference to external Microsoft Word document

Description

Reference to external Microsoft® Word document.

Construction

docxSubDocObj = DOCXSubDoc() creates an empty document reference.

docxSubDocObj = DOCXSubDoc(path) creates a reference to a Word document at the specified path. Appending this reference to a Word document (the master document) inserts a link to the subdocument at the point at which the reference is appended.

Opening a master document in Word causes the link to the subdocument to be displayed, instead of its content. To replace the link with the content, select Expand Subdocuments from the Outlining tab of the View tab on the Word toolstrip.

The rptview command expands subdocuments when it opens a Word document. You can also use docview to expand and unlink subdocuments.

Input Arguments

expand all

Path of document targeted by this reference, specified as a character vector.

Output Arguments

expand all

Path of Word document targeted by this reference, represented by an mlreportgen.dom.DOCXSubDoc object.

Properties

expand all

ID for this document element, specified as a character vector. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

Path of document targeted by this reference, specified as a character vector. Use ASCII characters. Use the following format for specifying a full path involving a mapped drive.

'file:///C:/UserPath/FileName.docx'

Methods

Method

Purpose

clone

Use DOCXSubDoc.clone in a similar way to how you use Paragraph.clone.

Clone this Word document reference.

Examples

expand all

import mlreportgen.dom.*

info = Document('CompanyInfo','docx');
append(info,'XYZ, Inc., makes widgets.');
close(info);

infoPath = info.OutputPath;

rpt = Document('Report','docx');
open(rpt);

append(rpt,Paragraph('About XYZ, Inc.'));

append(rpt,DOCXSubDoc(infoPath));

close(rpt);
rptview(rpt.OutputPath);
Was this topic helpful?