Package: mlreportgen.ppt
Formatted block of text (paragraph)
Use an object of the mlreportgen.ppt.Paragraph
class to include a
paragraph in a PPT API presentation. A paragraph can contain text,
mlreportgen.ppt.Text
objects, or
mlreportgen.ppt.ExternalLink
objects.
The mlreportgen.ppt.Paragraph
class is a handle
class.
HandleCompatible | true |
ConstructOnLoad | true |
For information on class attributes, see Class Attributes.
creates an empty paragraph object.paragraphObj
= mlreportgen.ppt.Paragraph()
creates a paragraph that contains an paragraphObj
= mlreportgen.ppt.Paragraph(text
)mlreportgen.ppt.Text
object with the text specified by text
.
creates a paragraph that contains the text or external link specified by
paragraphObj
= mlreportgen.ppt.Paragraph(pptElementObj
)pptElementObj
.
text
— Paragraph textParagraph text, specified as a character vector or string scalar.
pptElementObj
— Presentation element to include in paragraphmlreportgen.ppt.Text
object | mlreportgen.ppt.ExternalLink
objectPresentation element to include in the paragraph, specified as an
mlreportgen.ppt.Text
or
mlreportgen.ppt.ExternalLink
object.
Bold
— Whether to use bold for text[]
(default) | true
| false
Whether to use bold for the text in this paragraph, specified as
true
or false
. A setting of
false
uses regular weight text. A setting of
true
renders text in bold.
Font
— Font family for text[]
(default) | character vector | string scalarFont family for the text in this paragraph, specified as a character vector or string scalar. Specify a font that appears in the font list in Microsoft® PowerPoint®. To see the font list, in PowerPoint, on the Home tab, in the Font group, click the arrow to the right of the font.
ComplexScriptFont
— Font family for complex scripts[]
(default) | character vector | string scalarFont family for complex scripts, specified as a character vector or string scalar. Specify a font family to use when substituting in a locale that requires a complex script, such as Arabic or Asian, for rendering text.
FontColor
— Font color for text[]
(default) | character vector | string scalarFont color for the text in this paragraph, specified as a character vector or string scalar that consists of a CSS color name or hexadecimal RGB value.
For a list of CSS color names, see https://www.crockford.com/wrrrld/color.html.
To specify a hexadecimal RGB format, use #
as
the first character and two-digit hexadecimal numbers for the red,
green, and blue values. For example, '#0000ff'
specifies blue.
FontSize
— Font size of text[]
(default) | character vector | string scalarFont size of the text in this paragraph, specified as a character vector
or string scalar that consists of a number followed by a unit of
measurement. For example, '11pt'
specifies 11 points.
Valid abbreviations are:
px
— pixels (default)
cm
— centimeters
in
— inches
mm
— millimeters
pc
— picas
pt
— points
Italic
— Whether to use italic for text[]
(default) | true
| false
Whether to use italic for the text in this paragraph, specified as
true
or false
. A setting of
true
renders text in italic.
Strike
— Strikethrough style for text[]
(default) | 'single'
| 'none'
| 'double'
Strikethrough style for the text in this paragraph, specified as one of these values:
'single'
— Single horizontal line
'none'
— No strikethrough line
'double'
— Double horizontal line
Subscript
— Whether to display text as a subscript[]
(default) | true
| false
Whether to display the text in this paragraph as a subscript, specified as
true
or false
. A setting of
true
renders text as a subscript.
Superscript
— Whether to display text as a superscript[]
(default) | true
| false
Whether to display the text in this paragraph as a superscript, specified
as true
or false
. A setting of
true
renders text as a superscript.
Underline
— Underline style for text[]
(default) | 'single'
| 'double'
| ...Underline style for the text in this paragraph, specified as one of these values:
Value | Description |
---|---|
'single' | Single underline |
'double' | Double underline |
'heavy' | Thick underline |
'words' | Only words underlined (not spaces) |
'dotted' | Dotted underline |
'dottedheavy' | Thick, dotted underline |
'dash' | Dashed underline |
'dashheavy' | Thick, dashed underline |
'dashlong' | Long, dashed underline |
'dashlongheavy' | Thick, long, dashed underline |
'dotdash' | Dot-dash underline |
'dotdashheavy' | Thick, dot-dash underline |
'dotdotdash' | Dot-dot-dash underline |
'dotdotdashheavy' | Thick, dot-dot-dash underline |
'wavy' | Wavy underline |
'wavyheavy' | Thick, wavy underline |
'wavydouble' | Wavy, double underline |
'none' | No underline |
HAlign
— Horizontal alignment of text[]
(default) | character vector | string scalarHorizontal alignment of the text in this paragraph, specified as one of these values:
'center'
— Centered
'left'
— Left justified
'right'
— Right justified
'justified'
— Left justified and right justified, spacing words
evenly
'distributed'
— Left justified and right justified, spacing letters
evenly
'thaiDistributed'
— Left justified and right justified Thai text,
spacing characters evenly
'justifiedLow'
— Justification for Arabic text
Level
— Indentation level of paragraph[]
(default) | integer in the range [1,9]Indentation level of this paragraph, specified as an integer in the range
[1,9]. The value 1
indicates a top-level paragraph with
no indentation.
Style
— Paragraph formattingParagraph formatting, specified as a cell array of PPT format objects.
Add format objects by concatenating the existing value of the
Style
property with a cell array that contains the
format objects that you are adding. For
example:
para = mlreportgen.ppt.Paragraph('my paragraph'); para.Style = [para.Style {Bold(true),FontColor('red')}];
Children
— Children of this PPT API objectChild elements of this object, specified as a cell array of PPT objects. This property is read-only.
Parent
— Parent of this PPT API objectParent of this object, specified as a PPT object. This property is read-only.
Tag
— Tag for this PPT API objectTag for this PPT API object, specified as a character vector or string scalar. A
session-unique tag is generated 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.
Specifying your own tag value can help you to identify where an issue occurred during presentation generation.
Id
— ID for this PPT API objectID for this PPT API object, specified as a character vector or string scalar. A session-unique ID is generated as part of object creation. You can specify an ID to replace the generated ID.
append | Append content to paragraph |
Create a presentation with two slides.
import mlreportgen.ppt.*; ppt = Presentation('myParagraphPresentation.pptx'); open(ppt); add(ppt,'Title Slide'); add(ppt,'Title and Content');
Create an mlreportgen.ppt.Paragraph
object to use for the
title. Make the text bold and red.
p = Paragraph('My Title'); p.Bold = true; p.FontColor = 'red';
Replace the title for the first slide with the paragraph.
contents = find(ppt,'Title');
replace(contents(1),p);
Create a paragraph for the content of the second slide.
p1 = Paragraph('My slide content'); append(p1,' for the second slide');
Replace the content with the p1
paragraph.
replace(ppt,'Content',p1);
Close and view the presentation.
close(ppt); rptview(ppt);
Here are the slides in the generated presentation: