Main Content

mlreportgen.ppt.MessageEventData Class

Namespace: mlreportgen.ppt

Holds message triggering message event

Description

Contains the message that triggered a message event.

The mlreportgen.ppt.MessageEventData class is a handle class.

Creation

Description

messageEventDataObj = MessageEventData(msg) creates a message event data object that contains a PPT message, such as a message of type mlreportgen.ppt.ProgressMessage.

The PPT message dispatcher attaches an object of this type to a message event when it dispatches a message. Attaching the object enables message event listeners to retrieve the dispatched message. You need to create instances of this type only if you want to create your own message dispatcher.

example

Input Arguments

expand all

A message object, such as an mlreportgen.ppt.ProgressMessage object, that triggers a message event.

Properties

expand all

Object identifier for the mlreportgen.ppt.MessageEventData object, specified as a character vector or string scalar. The PPT API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

The value of this read-only property is a PPT message object, such as an mlreportgen.ppt.ProgressMessage object, that triggers a message event.

Tag for the mlreportgen.ppt.MessageEventData object, specified as a character vector or string scalar. The PPT API generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse all

When you add a dispatcher, the PPT API creates the evtdata object, which is an mlreportgen.ppt.MessageEventData object.

Create the presentation.

import mlreportgen.ppt.*;
pre = Presentation('myPresentation.pptx');

Create the listener and add it to the message dispatcher.

dispatcher = MessageDispatcher.getTheDispatcher;

dispatcher.Filter.ErrorMessagesPass = true;
dispatcher.Filter.ProgressMessagesPass = false;

l = addlistener(dispatcher,'Message', ...
@(src, evtdata) disp(evtdata.Message.formatAsText));

Create the message and dispatch it. Then open the presentation.

msg = ErrorMessage('Invalid slide',pre);
dispatch(dispatcher, msg);

open(pre);

Create an error in the program and dispatch the message before opening.

titleText = Text('This is a Title');
titleText.Style = {Bold};
replace(pre,'Title',titleText);

close(pre);

Version History

Introduced in R2015a