Add formatted numbers to a presentation by using the mlreportgen.ppt.Number
and mlreportgen.ppt.NumberFormat
classes. Set the number formatting for the first content slide using a default value for your session and for the second content slide to a format style for that specific Number
object.
Import the PPT namespace so that you do not have to use fully qualified names for the PPT API classes.
Set the default number formatting for the session.
Create a presentation and add a title slide.
Create the first title and content slide. Create an mlreportgen.ppt.Paragraph
object to use for the title of the slide.
Create a Number
object with pi
and convert it to a string with the toString
method.
Append the formatted number to the paragraph.
Replace the title in the first title and content slide with the paragraph.
Display the default format in the content text box.
Create the second title and content slide. Create an mlreportgen.ppt.Paragraph
object to use for the title of the slide.
Create a Number
object with pi
and convert it to a string with the toString
method. Limit the decimal places of pi
on this slide to two decimal points by specifying the format of the Number
and overriding the default number formatting.
Append the formatted number to the paragraph.
Replace the title in the second title and content slide with the paragraph.
Display the individual format in the content text box.
Close and view the presentation.